Xz Elasticsearch
Xz Elasticsearch – A [Silex][6] Service Provider based on Elasticsearch-Php, (*1)
Install the library
dependencies:, (*2)
A [Silex][6] Application, (*3)
Install with composer
Append following properties to your composer json, (*4)
"repositories": [
{
"type": "git",
"url": "https://github.com/xeroxzone/elasticsearch.git"
},
],
"require": {
"xeroxzone/elasticsearch": "dev-master"
},
Checkout from Git repository
Clone from Github, (*5)
Run Composer update for your project:, (*6)
$ php composer.phar update xeroxzone/elasticsearch
PHP configuration
PHP Version >= 5.5.x, (*7)
Use the library
Usage example:, (*8)
require_once __DIR__.'/../vendor/autoload.php';
use Silex\Application;
use Xz\Elasticsearch;
class MyApplication extends Application
{
use Elasticsearch\Traits\ElasticsearchTrait;
}
$application = new MyApplication();
$application->register(
new Elasticsearch\ElasticsearchServiceProvider(),
[
'elasticsearch.options' => [
'hosts' => [
'localhost:9200'
],
'connectionParams' => [
'auth' => [
'username',
'password',
'Basic'
]
]
]
]
);
$application->get('/', function() use ($application) {
$elasticsearch = $application->elasticsearch();
return $elasticsearch->ping();
});
$application->run();
Further examples are found here [ElasticsearchLibraryTest.php][7], (*9)
Copyright
Xz Elasticsearch is a product of 0xz.de
is licensed under the MIT license., (*10)
License
Elasticsearch-Php is licensed under the Apache License., (*11)
[Silex][6] is licensed under the MIT license., (*12)