KnpLabs / KnpLabs/php-github-api

Feature idea - throttling rate limiter plugin

Open
#973 0 comments 4 reactions 0 assignees View on GitHub
feature-request good first issue
Dominant language
PHP
Stars
2.2k
Forks
587
PR merge metrics
No merged PRs in 30d

Description

Something like this would come in handy:

```php
client = $client;
}

public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
{
$path = $request->getUri()->getPath();
if ($path === '/rate_limit') {
return $next($request);
}

/** @var RateLimitResource $resource */
$resource = $this->client->api('rate_limit')->getResource('core');
if ($resource->getRemaining() < 10) {
$reset = $resource->getReset();
$sleepFor = $reset - time();
if ($sleepFor > 0) {
sleep($sleepFor);
}
}

return $next($request);
}

}

```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names Client, RateLimitResource, and the Plugin request-handling methods, but no repository files, tests, or acceptance criteria. Start by locating those entry points and clarify the supported thresholds, waiting behavior, and test expectations; the issue does not define what completion looks like.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.