The Google API PHP Client uses Guzzle as its default HTTP client. Supply a configured Guzzle instance to the Google client:

$httpClient = new GuzzleHttp\Client([
    'proxy' => 'http://proxy.example.net:8080',
    'timeout' => 20,
]);

$googleClient = new Google\Client();
$googleClient->setHttpClient($httpClient);

Apply the application's normal Google authentication and service configuration to this client. Set the HTTP client before starting its token requests and creating the service objects that will use it.

The proxy option is a Guzzle request option, so its endpoint syntax and supported option structure follow Guzzle's interface. The Google client provides the injection point; there is no need to build a separate curl IO class inside the SDK.

When an application already maintains a shared Guzzle configuration, keep its required handlers and options on the instance passed here. An HTTP entry from the HTTP proxy list can supply its proxy URL for an allowed public Google API request only when that configured instance has no retained proxy credentials.

Artiglyn mynjee