wizacha/aws-signature-middleware

This package is abandoned and no longer maintained. No replacement package was suggested.

Middleware to sign request for AWS API

v0.1.2 2018-01-12 10:27 UTC

This package is not auto-updated.

Last update: 2020-10-20 08:16:28 UTC


README

Kind of connector to use AWS Elasticsearch Service with elastic/elasticsearch-php client

Build Status

Installation

composer require wizacha/aws-signature-middleware

Usage

Exemple with elasticsearch client

<?php
$credentials = new \Aws\Credentials\Credentials('id', 'secret');
$signature = new \Aws\Signature\SignatureV4('es', 'eu-west-1');

$middleware = new \Wizacha\Middleware\AwsSignatureMiddleware($credentials, $signature);
$defaultHandler = \Elasticsearch\ClientBuilder::defaultHandler();
$awsHandler = $middleware($defaultHandler);

$clientBuilder =  \Elasticsearch\ClientBuilder::create();

$clientBuilder
    ->setHandler($awsHandler)
    ->setHosts(['endpoint.eu-west-1.es.amazonaws.com:80'])
;
$client = $clientBuilder->build();