Reference documentation and code samples for the Google Auth Library Client class SimpleMiddleware.
SimpleMiddleware is a Guzzle Middleware that implements Google's Simple API
access.
Requests are accessed using the Simple API access developer key.
Namespace
Google \ Auth \ Middleware
Methods
__construct
Create a new Simple plugin.
The configuration array expects one option
key: required, otherwise InvalidArgumentException is thrown
Parameter
Name
Description
config
array
Configuration array
__invoke
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();
$stack->push($middleware);
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Google Auth Library Client - Class SimpleMiddleware (1.47.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.47.1 (latest)](/php/docs/reference/auth/latest/Middleware.SimpleMiddleware)\n- [1.47.0](/php/docs/reference/auth/1.47.0/Middleware.SimpleMiddleware)\n- [1.46.0](/php/docs/reference/auth/1.46.0/Middleware.SimpleMiddleware)\n- [1.45.2](/php/docs/reference/auth/1.45.2/Middleware.SimpleMiddleware) \nReference documentation and code samples for the Google Auth Library Client class SimpleMiddleware.\n\nSimpleMiddleware is a Guzzle Middleware that implements Google's Simple API\naccess.\n\nRequests are accessed using the Simple API access developer key.\n\nNamespace\n---------\n\nGoogle \\\\ Auth \\\\ Middleware\n\nMethods\n-------\n\n### __construct\n\nCreate a new Simple plugin.\n\nThe configuration array expects one option\n\n- key: required, otherwise InvalidArgumentException is thrown\n\n### __invoke\n\nUpdates the request query with the developer key if auth is set to simple.\n\nuse Google\\\\Auth\\\\Middleware\\\\SimpleMiddleware;\nuse GuzzleHttp\\\\Client;\nuse GuzzleHttp\\\\HandlerStack;\n\n$my_key = 'is not the same as yours';\n$middleware = new SimpleMiddleware(\\['key' =\\\u003e $my_key\\]);\n$stack = HandlerStack::create();\n$stack-\\\u003epush($middleware);\n\n$client = new Client(\\[\n'handler' =\\\u003e $stack,\n'base_uri' =\\\u003e '\u003chttps://www.googleapis.com/discovery/v1/\u003e',\n'auth' =\\\u003e 'simple'\n\\]);\n\n$res = $client-\\\u003eget('drive/v2/rest');"]]