naresh / elasticsearchclient
ElasticSearch client library with amazon elasticsearch PHP signing handler
Installs: 4 060
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/naresh/elasticsearchclient
Requires
- php: >=7.0
- aws/aws-sdk-php: ^3.8
- elasticsearch/elasticsearch: ~5.0
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ~3.0
- phpunit/phpunit: ^6.2.3
This package is not auto-updated.
Last update: 2025-12-25 06:23:32 UTC
README
ElasticSearch client library with amazon elasticsearch PHP signing handler. This library is targeted for laravel but can also be used with other frameworks.
Installation
Require package in composer.json file.
"require":{
"naresh/elasticsearchclient": "1.0.*",
}
And run composer update to update the dependency.
Configuration (Laravel Only)
NOTE: You do not have to add ServerProvider and Facade if you are using Laravel 5.5 package autodiscovery.
Add the ServiceProvider to the providers array in config/app.php
Naresh\ElasticSearchClient\ServiceProvider::classAdd EsClient Facade in config/app.php
'EsClient' => Naresh\ElasticSearchClient\Facade\EsClient::class,
Usage
You can get the new Elasticsearch instance in two ways
1) With EsClient Facade (Laravel Only)
* `EsClient::getClient($options)`
2) With new instance of Naresh\ElasticSearchClient\ElasticSearchClient
* `new ElasticSearchClient($options)`
$options
[
'hosts' => [],
'aws_host' => false,
'access_key' => '',
'secret_key' => '',
'region' => ''
];
hosts (array)
- Elasticsearch host(s)
aws_host (boolean)
- Boolean flag to specify if the hostname is AWS Elasticsearch service, however if your host has
amazonawsin its URL then you dont have to add this flag, this library will assume it as AWS Elasticsearch service
- Boolean flag to specify if the hostname is AWS Elasticsearch service, however if your host has
access_key(string only needed if host is AWS Elasticsearch service)
- AWS Elasticsearch service access key
secret_key(string only needed if host is AWS Elasticsearch service)
- AWS Elasticsearch service secret key
region(string only needed if host is AWS Elasticsearch service)
- AWS Elasticsearch service region
Run tests
Run unit test with phpunit following command.
vendor/bin/phpunit -v
It will generate test coverage reports in reports folder