{"id":16331602,"url":"https://github.com/soxft/rate-limit","last_synced_at":"2026-05-09T18:40:26.016Z","repository":{"id":49169274,"uuid":"461103919","full_name":"soxft/rate-limit","owner":"soxft","description":"General purpose rate limiter implementation.","archived":false,"fork":false,"pushed_at":"2024-07-18T07:41:01.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-27T16:32:35.658Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soxft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-19T06:12:12.000Z","updated_at":"2024-07-18T07:41:04.000Z","dependencies_parsed_at":"2024-02-20T13:49:09.322Z","dependency_job_id":"64fe5455-9ae9-4214-a2a2-c0de87097f1c","html_url":"https://github.com/soxft/rate-limit","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"2e3d08434d4a49c502db124983b44ef8d9ffe094"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/soxft/rate-limit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soxft%2Frate-limit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soxft%2Frate-limit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soxft%2Frate-limit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soxft%2Frate-limit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soxft","download_url":"https://codeload.github.com/soxft/rate-limit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soxft%2Frate-limit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32831493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T23:27:46.023Z","updated_at":"2026-05-09T18:40:25.992Z","avatar_url":"https://github.com/soxft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rate Limit\n\n\u003e 基于Redis 的 PHP 速率限制\n \n## Installation\n\n```bash\ncomposer require soxft/rate-limit\n```\n\n## Usage\n\n**Terminating rate limiter**\n\n```php\nuse RateLimit\\Rate;\nuse RateLimit\\RateLimiter;\nuse RateLimit\\Exception\\LimitExceededException;\n\n$rateLimiter = new RateLimiter(Rate::perMinute(100), new \\Redis());\n\n$apiKey = 'abc123'; // 用户标识\n\ntry {\n    $rateLimiter-\u003elimit($apiKey);\n    \n    //on success\n} catch (LimitExceededException $exception) {\n   //on limit exceeded\n}\n```\n\n**Silent rate limiter**\n\n```php\nuse RateLimit\\Rate;\nuse RateLimit\\RateLimiter;\n\n$rateLimiter = new RateLimiter(Rate::perMinute(100), new \\Redis());\n\n$ipAddress = '192.168.1.2';\n$status = $rateLimiter-\u003elimitSilently($ipAddress);\n\necho $status-\u003eleft(); //99\n```\n\n## License\n\nReleased under MIT License - see the [License File](LICENSE) for details.\n\nSecondary development based on [nikolaposa/rate-limie](https://github.com/nikolaposa/rate-limit)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoxft%2Frate-limit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoxft%2Frate-limit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoxft%2Frate-limit/lists"}