PHP client for SearChili API
- PHP 5.6+
- Autoloader compatible with PSR-4
- PHP must be compiled with lib-curl
To install the library just add it via composer
composer require SearChili/searchili-client-php
Or in composer.json
{
"SearChili/searchili-client-php": "^1.0"
}
We can use the composer to run the tests:
composer test
To use this library, you must first register on SearChili. After the registration, an apiKey and apiSecret will be available to access the API.
The API methods that can be invoked:
- Site info
- Entity search
- Entity sayt
- Entity store
- Entity delete
The following is a small example of how this library can be used.
<?php
require_once "vendor/autoload.php";
use SearChili\Alice\Client as SearChiliAliceClient;
$client = new SearChiliAliceClient('<apiKey>');
$entities = $client->entity->search('query');
print_r($entities);
<?php
require_once "vendor/autoload.php";
use SearChili\Bob\Client as SearChiliBobClient;
$client = new SearChiliBobClient('<apiSecret>');
$response = $client->site->get();
print_r($response->toArray());
$result = $aliceClient->entity->store(
1, // ID
'Example Title', // Title
'http://domain.com/article-1', // Link
'This is excerpt', // Excerpt
'This will be the long body of this amazing article.' // Body
);
print_r($result);
$result = $aliceClient->entity->delete(1);
var_dump($result);
This library follows the terms of use of MIT