emartech/guzzle-escher-middleware

Escher authentication middleware for Guzzle Http Client

0.2.2 2018-12-13 16:33 UTC

This package is auto-updated.

Last update: 2024-12-08 01:22:36 UTC


README

Codeship Status for emartech/guzzle-escher-middleware GitHub license

Guzzle Escher Middleware

This authentication middleware add Escher sign functionality to Guzzle Http Client.

Installation

composer require emartech/guzzle-escher-middleware

Usage

<?php

$credential = new \Guzzle\Http\Middleware\EscherCredential('key', 'secret', 'some/credential/scope');
$escherMiddleware = new \Guzzle\Http\Middleware\EscherMiddleware($credential);

$stack = \GuzzleHttp\HandlerStack::create();

$stack->push($escherMiddleware);

$client   = new \GuzzleHttp\Client(['handler' => $stack]);

// Important: set the auth option to escher to activate the middleware
$response = $client->get('http://www.8points.de', ['auth' => 'escher']);