adiliogobira/elastic-client

The official PHP Elasticsearch client integrated with Laravel

Maintainers

👁 adiliogobira

Package info

github.com/adiliogobira/elastic-client

pkg:composer/adiliogobira/elastic-client

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

v1.1.0 2020-07-09 10:19 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT ab5de56bb179a4ef5505058f69c9db95c8bdf1d5

  • Ivan Babenko <babenko.i.a.woop@gmail.com>

phpclientelasticsearchlaravelelastic

This package is auto-updated.

Last update: 2026-06-11 05:47:07 UTC


README

👁 Latest Stable Version
👁 Total Downloads
👁 License
👁 Build Status
👁 Donate PayPal
👁 Donate Amazon

The official PHP Elasticsearch client integrated with Laravel.

Contents

Compatibility

The current version of Elastic Client has been tested with the following configuration:

  • PHP 7.2-7.4
  • Elasticsearch 7.x

Installation

The library can be installed via Composer:

composer require babenkoivan/elastic-client

Configuration

To change the client settings you need to publish the configuration file first:

php artisan vendor:publish --provider="ElasticClient\ServiceProvider"

You can use any settings supported by \Elasticsearch\ClientBuilder::fromConfig method in the config/elastic.client.php file as this factory is used under the hood:

return [
 'hosts' => [
 env('ELASTIC_HOST', 'localhost:9200'),
 ]
];

Usage

Type hint \Elasticsearch\Client or use resolve function to retrieve the client instance in your code:

namespace App\Console\Commands;

use Elasticsearch\Client;
use Illuminate\Console\Command;

class CreateIndex extends Command
{
 protected $signature = 'create:index {name}';

 protected $description = 'Creates an index';

 public function handle(Client $client)
 {
 $client->indices()->create([
 'index' => $this->argument('name')
 ]);
 }
}