Documentation

SimpleMiddleware
in package

SimpleMiddleware is a Guzzle Middleware that implements Google's Simple API access.

Requests are accessed using the Simple API access developer key.

Table of Contents

Properties

$config  : array<string|int, mixed>

Methods

__construct()  : mixed
Create a new Simple plugin.
__invoke()  : Closure
Updates the request query with the developer key if auth is set to simple.

Properties

Methods

__construct()

Create a new Simple plugin.

public __construct(array<string|int, mixed> $config) : mixed

The configuration array expects one option

  • key: required, otherwise InvalidArgumentException is thrown
Parameters
$config : array<string|int, mixed>

Configuration array

__invoke()

Updates the request query with the developer key if auth is set to simple.

public __invoke(callable $handler) : Closure

use Google\Auth\Middleware\SimpleMiddleware; use GuzzleHttp\Client; use GuzzleHttp\HandlerStack;

$my_key = 'is not the same as yours'; $middleware = new SimpleMiddleware(['key' => $my_key]); $stack = HandlerStack::create(); $stack->push($middleware);

$client = new Client([ 'handler' => $stack, 'base_uri' => 'https://www.googleapis.com/discovery/v1/', 'auth' => 'simple' ]);

$res = $client->get('drive/v2/rest');

Parameters
$handler : callable
Return values
Closure

        
On this page

Search results