KnpLabs / KnpLabs/php-github-api

Feature idea - throttling rate limiter plugin

未关闭
#973 0 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看
feature-request good first issue
主要语言
PHP
星标
2.2k
派生
587
PR 合并指标
30 天内没有已合并 PR

描述

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);
}

}

```

贡献指南

这个仓库没有索引到贡献指南

调研方向

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.

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
api
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。