PHP code example of algolia / algoliasearch-client-php

1. Go to this page and download the library: Download algolia/algoliasearch-client-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

algolia / algoliasearch-client-php example snippets


$client = Algolia\AlgoliaSearch\SearchClient::create(
  'YourApplicationID',
  'YourAdminAPIKey'
);

$index = $client->initIndex('your_index_name');

$index->saveObject(['objectID' => 1, 'name' => 'Foo']);

$objects = $index->search('Fo');
bash
composer