lavamusic / elasticsearch-php-client
Requires
- php: ^7.3 || ^8.0
- ext-json: >=1.3.7
- ext-swoole: >=4.4.23
- easyswoole/http-client: ^1.5
- easyswoole/swoole-ide-helper: ^1.3
- monolog/monolog: ^2.4
- psr/log: ^1.1
Requires (Dev)
- easyswoole/phpunit: ^1.1
This package is not auto-updated.
Last update: 2024-11-12 14:44:48 UTC
README
This is the PHP client for Elasticsearch, which is implemented with reference to the official PHP client of Elasticsearch.
The main purpose of this component is to facilitate users to operate es in the swoole related frameworks.
The cURL request driver layer is implemented using the swoole coroutine client. You can use it in swoole related frameworks (eg: EasySwoole, Hyperf, Swoft, IMIPHP, Mix-PHP, etc.).
Contents
Getting started 🐣
Using this client assumes that you have an Elasticsearch server installed and running.
You can install the client in your PHP project using composer:
composer require lavamusic/elasticsearch-php-client "dev-main"
After the installation you can connect to Elasticsearch using the ClientBuilder
class. For instance, if your Elasticsearch is running on localhost:9200
you can use the following code:
<?php use LavaMusic\Elasticsearch\ClientBuilder; $client = ClientBuilder::create() ->setHosts(['localhost:9200']) ->build(); // Info API $response = $client->info(); echo $response['version']['number']; // 7.10.1
License 📗
Apache License 2.0