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

Requests are accessed using the Simple API access developer key.

public __construct(array $config)

Create a new Simple plugin.

The configuration array expects one option

  • key: required, otherwise InvalidArgumentException is thrown
    public __invoke(callable $handler)

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

    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();

    $client = new Client([

    'handler' => $stack,
    'base_uri' => '',
    'auth' => 'simple'


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

    • return Closure
    private $config
    • var array
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only