Search API Client for PHP

Features

  • Gives API access to all Algolia functionality, settings, advanced features, and ML/AI products including Recommend
  • Installs with and without Composer
  • Supports HTTP headers, Guzzle6, and Curl (php53HttpClient)
  • Comes with a CLI for debugging
  • Background retry strategy to ensure uptime
  • Seamless batching via iterators to optimize number of network calls
  • Zero downtime reindexing feature
  • Thin & minimal low-level HTTP client to interact with Algolia's API

Version

  • Supports all modern PHP versions (7.2+)

Related Integrations

  • Laravel, Symfony, Magento, Wordpress
  • InstantSearch for React, Vue, Angular, vanilla 
  • Autocomplete

Key links


Get started

INSTALL

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]);

Built with Algolia