Meilisearch PHP | Documentation

Client
in package
implements Http

Table of Contents

Interfaces

Http

Properties

$baseUrl  : string
$headers  : array<string, string>
$http  : ClientInterface
$json  : Json
$requestFactory  : RequestFactoryInterface
$streamFactory  : StreamFactoryInterface

Methods

__construct()  : mixed
delete()  : mixed
get()  : mixed
patch()  : mixed
post()  : mixed
put()  : mixed
buildQueryString()  : string
execute()  : mixed
isJSONResponse()  : bool
Checks if any of the header values indicate a JSON response.
parseResponse()  : mixed

Properties

$baseUrl

private string $baseUrl

$headers

private array<string, string> $headers

$http

private ClientInterface $http

$requestFactory

private RequestFactoryInterface $requestFactory

$streamFactory

private StreamFactoryInterface $streamFactory

Methods

__construct()

public __construct(string $url[, string|null $apiKey = null ][, ClientInterface|null $httpClient = null ][, RequestFactoryInterface|null $reqFactory = null ][, array<int, string> $clientAgents = [] ][, StreamFactoryInterface|null $streamFactory = null ]) : mixed
Parameters
$url : string
$apiKey : string|null = null
$httpClient : ClientInterface|null = null
$reqFactory : RequestFactoryInterface|null = null
$clientAgents : array<int, string> = []
$streamFactory : StreamFactoryInterface|null = null

delete()

public delete(string $path[, array<string|int, mixed> $query = [] ]) : mixed
Parameters
$path : string
$query : array<string|int, mixed> = []
Tags
throws
ClientExceptionInterface
throws
ApiException

get()

public get(string $path[, array<string|int, mixed> $query = [] ]) : mixed
Parameters
$path : string
$query : array<string|int, mixed> = []
Tags
throws
ClientExceptionInterface
throws
ApiException
throws
CommunicationException

patch()

public patch(string $path[, mixed|null $body = null ][, array<string|int, mixed> $query = [] ]) : mixed
Parameters
$path : string
$body : mixed|null = null
$query : array<string|int, mixed> = []
Tags
throws
ApiException
throws
JsonEncodingException

post()

public post(string $path[, mixed|null $body = null ][, array<string|int, mixed> $query = [] ][, string|null $contentType = null ]) : mixed
Parameters
$path : string
$body : mixed|null = null
$query : array<string|int, mixed> = []
$contentType : string|null = null
Tags
throws
ApiException
throws
ClientExceptionInterface
throws
CommunicationException
throws
JsonEncodingException

put()

public put(string $path[, mixed $body = null ][, array<string|int, mixed> $query = [] ][, string|null $contentType = null ]) : mixed
Parameters
$path : string
$body : mixed = null
$query : array<string|int, mixed> = []
$contentType : string|null = null

buildQueryString()

private buildQueryString([array<string|int, mixed> $queryParams = [] ]) : string
Parameters
$queryParams : array<string|int, mixed> = []
Return values
string

isJSONResponse()

Checks if any of the header values indicate a JSON response.

private isJSONResponse(array<string|int, mixed> $headerValues) : bool
Parameters
$headerValues : array<string|int, mixed>

the array of header values to check

Return values
bool

true if any header value contains 'application/json', otherwise false


On this page

Search results