webgriffe / amp-elasticsearch
A non-blocking ElasticSearch client for PHP based on Amp.
Installs: 3 073
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 3
Open Issues: 1
Requires
- php: ~7.4.0|~8.0.0|~8.1.0|~8.2.0|~8.3.0
- ext-json: *
- amphp/amp: ^2.1
- amphp/http-client: ^4.5
Requires (Dev)
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-11-07 16:14:59 UTC
README
webgriffe/amp-elasticsearch
is a non-blocking ElasticSearch client for use with the amp
concurrency framework.
Required PHP Version
- PHP 7.4
- PHP 8.0
- PHP 8.1
- PHP 8.2
- PHP 8.3
Installation
composer require webgriffe/amp-elasticsearch
Usage
Just create a client instance and call its public methods which returns promises:
Loop::run(function () { $client = new Webgriffe\AmpElasticsearch\Client('http://my.elasticsearch.test:9200'); yield $this->client->createIndex('myindex'); $response = yield $this->client->indexDocument('myindex', '', ['testField' => 'abc']); echo $response['result']; // 'created' });
See other usage examples in the tests/Integration/ClientTest.php
.
All client methods return an array representation of the ElasticSearch REST API responses in case of sucess or an Webgriffe\AmpElasticsearch\Error
in case of error.
Security
If you discover any security related issues, please email support@webgriffe.com
instead of using the issue tracker.
License
The MIT License (MIT). Please see LICENSE
for more information.