Version
- Supports all modern PHP versions (7.2+)
Install (get a free account here.)
1composer require algolia/algoliasearch-client-php
Index
1$res = $index->saveObjects( 2 [ 3 [ 4 'objectID' => 'myID1', 5 'firstname' => 'Jimmie', 6 'lastname' => 'Barninger' 7 ], 8 [ 9 'objectID' => 'myID2', 10 'firstname' => 'Warren', 11 'lastname' => 'Speach' 12 ] 13 ] 14);
Search
1$index = $client->initIndex('contacts'); 2 3// without search parameters 4$res = $index->search('query string'); 5 6// with search parameters 7$res = $index->search('query string', [ 8 'attributesToRetrieve' => [ 9 'firstname', 10 'lastname', 11 ], 12 'hitsPerPage' => 50 13]);