Skip to content

xeroxzone/elasticsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xz Elasticsearch

Xz Elasticsearch – A Silex Service Provider based on Elasticsearch-Php

Install the library

dependencies:

A Silex Application

Install with composer

Append following properties to your composer json

"repositories": [
    {
        "type": "git",
        "url": "https://github.com/xeroxzone/elasticsearch.git"
    },
],
"require": {
    "xeroxzone/elasticsearch": "dev-master"
},

Checkout from Git repository

Clone from Github

Run Composer update for your project:

$ php composer.phar update xeroxzone/elasticsearch

PHP configuration

PHP Version >= 5.5.x

Use the library

Usage example:

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

Copyright

Xz Elasticsearch is a product of 0xz.de is licensed under the MIT license.

License

Elasticsearch-Php is licensed under the Apache License.

Silex is licensed under the MIT license.

About

Xz Elasticsearch – A Silex Service Provider based on Elasticsearch-Php

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages