wizacha / aws-signature-middleware
Middleware to sign request for AWS API
Installs: 500 374
Dependents: 0
Suggesters: 0
Security: 0
Stars: 25
Watchers: 3
Forks: 7
Open Issues: 2
Requires
- aws/aws-sdk-php: ^3.8
Requires (Dev)
- phpunit/phpunit: ^6.5
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
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();