PHP code example of adiliogobira / elastic-client
1. Go to this page and download the library: Download adiliogobira/elastic-client library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
adiliogobira / elastic-client example snippets
return [
'hosts' => [
env('ELASTIC_HOST', 'localhost:9200'),
]
];
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')
]);
}
}
bash
php artisan vendor:publish --provider="ElasticClient\ServiceProvider"