The official PHP Elasticsearch client integrated with Laravel
adiliogobira/elastic-client is a Laravel package for the official php elasticsearch client integrated with laravel.
It currently has 0 GitHub stars and 8 downloads on Packagist (latest version v1.1.0).
Install it with composer require adiliogobira/elastic-client.
Discover more Laravel packages by adiliogobira
or browse all Laravel packages to compare alternatives.
Last updated
The official PHP Elasticsearch client integrated with Laravel.
The current version of Elastic Client has been tested with the following configuration:
The library can be installed via Composer:
composer require babenkoivan/elastic-client
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'),
]
];
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')
]);
}
}