Search API Client for PHP
Algolia PHP Client

API-first search and discovery for your PHP applications.

Utilize the Algolia open-source PHP API client to index your data, configure your search, add analytics and much more.  

Algolia is an API-First Search and Discovery platform that empowers builders to compose experiences at scale. Explore Algolia

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

Key links


Get started

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]);
Get started for freeExplore all developer docs

Built with Algolia

Frontend Tools
Code samples

Autocomplete Playground

Typeahead dropdown playground built with the Algolia Autocomplete library

  • javascript
  • nodejs