AlgoliaSearch\Client
Entry point in the PHP API.
You should instantiate a Client object with your ApplicationID, ApiKey and Hosts
to start using Algolia Search API.
Synopsis
class Client
{
- // constants
- const CAINFO = 'cainfo';
- const CURLOPT = 'curloptions';
- const PLACES_ENABLED = 'placesEnabled';
- const FAILING_HOSTS_CACHE = 'failingHostsCache';
- // members
- protected ClientContext $context;
- protected $caInfoPath;
- protected $curlConstants;
- protected array $curlOptions = ;
- protected bool $placesEnabled = false;
- // methods
- public void __construct()
- public void __destruct()
- public void setConnectTimeout()
- public void enableRateLimitForward()
- public void setForwardedFor()
- public void setAlgoliaUserToken()
- public void disableRateLimitForward()
- public void isAlive()
- public void setExtraHeader()
- public mixed multipleQueries()
- public mixed listIndexes()
- public mixed deleteIndex()
- public mixed moveIndex()
- public mixed copyIndex()
- public mixed getLogs()
- public Index initIndex()
- public mixed listApiKeys()
- public mixed listUserKeys()
- public mixed getApiKey()
- public mixed getUserKeyACL()
- public mixed deleteApiKey()
- public mixed deleteUserKey()
- public mixed addApiKey()
- public mixed addUserKey()
- public mixed updateApiKey()
- public mixed updateUserKey()
- public mixed batch()
- public static string generateSecuredApiKey()
- public static string buildQuery()
- public mixed request()
- public mixed doRequest()
- protected array checkCurlOptions()
- protected array getCurlConstants()
- protected void invalidOptions()
- private PlacesIndex getPlacesIndex()
- public static PlacesIndex initPlaces()
- public void getContext()
Constants
Name | Value |
---|---|
CAINFO | 'cainfo' |
CURLOPT | 'curloptions' |
PLACES_ENABLED | 'placesEnabled' |
FAILING_HOSTS_CACHE | 'failingHostsCache' |
Members
protected
- $caInfoPath — string
- $context — AlgoliaSearch\ClientContext
- $curlConstants — array
- $curlOptions — array
- $placesEnabled — AlgoliaSearch\bool
Methods
private
protected
- checkCurlOptions() — Checks if curl option passed are valid curl options.
- getCurlConstants() — Get all php curl available options.
- invalidOptions() — throw clear Exception when bad curl option is set.
public
- __construct() — Algolia Search initialization.
- __destruct() — Release curl handle.
- addApiKey() — Create a new API key.
- addUserKey()
- batch() — Send a batch request targeting multiple indices.
- buildQuery()
- copyIndex() — Copy an existing index.
- deleteApiKey() — Delete an existing API key.
- deleteIndex() — Delete an index.
- deleteUserKey()
- disableRateLimitForward() — Disable IP rate limit enabled with enableRateLimitForward() function.
- doRequest()
- enableRateLimitForward() — Allow to use IP rate limit when you have a proxy between end-user and Algolia.
- generateSecuredApiKey() — Generate a secured and public API Key from a list of query parameters and an optional user token identifying the current user.
- getApiKey() — Get ACL of a API key.
- getContext()
- getLogs() — Return last logs entries.
- getUserKeyACL()
- initIndex() — Get the index object initialized (no server call needed for initialization).
- initPlaces()
- isAlive() — Call isAlive.
- listApiKeys() — List all existing API keys with their associated ACLs.
- listIndexes() — List all existing indexes return an object in the form: array( "items" => array( array("name" => "contacts", "createdAt" => "2013-01-18T15:33:13.556Z"), array("name" => "notes", "createdAt" => "2013-01-18T15:33:13.556Z") ) ).
- listUserKeys()
- moveIndex() — Move an existing index.
- multipleQueries() — This method allows to query multiple indexes with one API call.
- request()
- setAlgoliaUserToken() — It's possible to use the following token to track users that have the same IP or to track users that use different devices.
- setConnectTimeout() — Change the default connect timeout of 1s to a custom value (only useful if your server has a very slow connectivity to Algolia backend).
- setExtraHeader() — Allow to set custom headers.
- setForwardedFor() — The aggregation of the queries to retrieve the latest query uses the IP or the user token to work efficiently.
- updateApiKey() — Update an API key.
- updateUserKey()