thephpleague / oauth1-client

OAuth 1 Client
MIT License
968 stars 73 forks source link

Guzzle HTTP Client configuration #106

Open hareku opened 4 years ago

hareku commented 4 years ago

I really want to pass the configuration to Guzzle HTTP Client for setting timeout, and I have a proposal for that.

Add $clientOptions to the constructor of /src/Client/Server/Server.php

abstract class Server
{
    /**
     * @var array
     */
    protected $clientOptions;

    /**
     * Create a new server instance.
     *
     * @param ClientCredentialsInterface|array $clientCredentials
     * @param SignatureInterface               $signature
     * @param array  $clientOptions
     */
    public function __construct($clientCredentials, SignatureInterface $signature = null, $clientOptions)
bencorlett commented 4 years ago

I see what you're saying. I'm almost leaning to adding something like:

$server->resolveHttpClientUsing(function (): \GuzzleHttp\Client {
   // Return your client here
});

This would keep the signature the same as currently. Note: In the next major version, the client will be resolved externally to each server instance.