PHP code example of fabschtr / aws-es-php-handler

1. Go to this page and download the library: Download fabschtr/aws-es-php-handler 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/ */

    

fabschtr / aws-es-php-handler example snippets


use Elasticsearch\ClientBuilder;
use Fabschtr\AwsEsPhpHandler\AwsElasticsearchPhpHandler;

$handler = new AwsElasticsearchPhpHandler('AWS_KEY', 'AWS_SECRET', 'eu-central-1');

$this->client = ClientBuilder::create()
            ->setHandler($handler)
            ->setHosts('ELASTIC_HOSTS')
            ->build();

composer