Search API Client for PHP

PHP + Algolia

Build search experiences with libraries & UI components.

Sign up
What is Algolia

What is Algolia

Algolia empowers modern developers to build world class search and discovery experiences without any DevOps.
Libraries with every major language and framework make it easy to enrich your users' experiences. 

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

Get started

  • Install (get a free account here.)
    1
    composer 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 free
Explore developer docs