thephpleague / oauth2-client

Easy integration with OAuth 2.0 service providers.
http://oauth2-client.thephpleague.com
MIT License
3.66k stars 752 forks source link

Suggestion - a very small code change would implement rate limiting #968

Open globalvisionmedia opened 2 years ago

globalvisionmedia commented 2 years ago

a lot of APIs have rate limiting but...

If you were to add: $client_options = ['timeout', 'proxy', 'handler'];

then we could use this: composer require spatie/guzzle-rate-limiter-middleware and write apps that include (for example)

$stack = HandlerStack::create(); $stack->push(RateLimiterMiddleware::perSecond(8));

$provider = new Provider([ 'clientId' => MYOB_CLIENT_ID, 'clientSecret' => MYOB_CLIENT_SECRET, 'redirectUri' => CALLBACK_URI, 'username' => USERNAME, 'password' => PASSWORD, 'scopes' => ['CompanyFile'], 'handler' => $stack ]);