{"id":26229609,"url":"https://github.com/sharpapi/php-core","last_synced_at":"2026-02-06T09:14:11.111Z","repository":{"id":262633178,"uuid":"887873252","full_name":"sharpapi/php-core","owner":"sharpapi","description":"SharpAPI.com PHP Core functionalities \u0026 communication","archived":false,"fork":false,"pushed_at":"2025-01-10T09:42:39.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-29T11:51:45.383Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sharpapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-13T12:38:24.000Z","updated_at":"2025-01-10T09:41:41.000Z","dependencies_parsed_at":"2024-11-13T13:45:10.968Z","dependency_job_id":"6f671259-8284-4040-9d43-3a49d58dad57","html_url":"https://github.com/sharpapi/php-core","commit_stats":null,"previous_names":["sharpapi/php-core"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Fphp-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Fphp-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Fphp-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Fphp-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharpapi","download_url":"https://codeload.github.com/sharpapi/php-core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249220902,"owners_count":21232422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-03-12T22:17:03.779Z","updated_at":"2026-02-06T09:14:11.106Z","avatar_url":"https://github.com/sharpapi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![SharpAPI GitHub cover](https://sharpapi.com/sharpapi-github-laravel-bg.jpg \"SharpAPI Laravel Client\")\n\n# SharpAPI.com PHP Core functionalities \u0026 communication\n\n## 🚀 Automate workflows with AI-powered API\n\n### Leverage AI API to streamline workflows in E-Commerce, Marketing, Content Management, HR Tech, Travel, and more.\n\nSee more at [SharpAPI.com Website \u0026raquo;](https://sharpapi.com/)\n\n---\n\n## Quota Method\n\nThe `quota()` method returns a `SubscriptionInfo` DTO with the following fields:\n\n| Field | Type | Description |\n|---|---|---|\n| `timestamp` | `Carbon` | Timestamp of the subscription check |\n| `on_trial` | `bool` | Whether the account is on a trial period |\n| `trial_ends` | `Carbon` | End date of the trial period |\n| `subscribed` | `bool` | Whether the user is currently subscribed |\n| `current_subscription_start` | `Carbon` | Start of the current subscription period |\n| `current_subscription_end` | `Carbon` | End of the current subscription period |\n| `current_subscription_reset` | `Carbon` | Quota reset timestamp |\n| `subscription_words_quota` | `int` | Total word quota for the period |\n| `subscription_words_used` | `int` | Words used in the current period |\n| `subscription_words_used_percentage` | `float` | Percentage of word quota used |\n| `requests_per_minute` | `int` | Maximum API requests allowed per minute |\n\n```php\n$client = new SharpApiClient('your-api-key');\n$quota = $client-\u003equota();\n\necho $quota-\u003esubscription_words_quota;\necho $quota-\u003erequests_per_minute;\n```\n\n---\n\n## Rate Limiting\n\nThe SDK automatically handles API rate limits. When the API returns HTTP 429 (Too Many Requests), the client will:\n\n1. **Retry automatically** — reads the `Retry-After` header, sleeps for the specified duration, and retries the request (up to 3 times by default).\n2. **Slow down polling** — during `fetchResults()`, when `X-RateLimit-Remaining` drops below the low threshold, polling intervals are automatically increased to avoid hitting the limit.\n\n### Inspecting Rate-Limit State\n\nAfter any API call, you can check the current rate-limit values:\n\n```php\n$client = new SharpApiClient('your-api-key');\n$client-\u003eping();\n\necho $client-\u003egetRateLimitLimit();     // e.g. 60 (requests per window)\necho $client-\u003egetRateLimitRemaining(); // e.g. 58 (remaining in current window)\n```\n\n\u003e **Note:** `getRateLimitLimit()` and `getRateLimitRemaining()` return `null` before the first API call or after endpoints that don't return rate-limit headers (e.g. `/ping`, `/quota`).\n\n### Configuration\n\n```php\n// Max automatic retries on HTTP 429 (default: 3)\n$client-\u003esetMaxRetryOnRateLimit(5);\n\n// Threshold below which polling intervals are increased (default: 3)\n$client-\u003esetRateLimitLowThreshold(5);\n```\n\nWhen `rateLimitRemaining` is at or below the threshold, polling intervals in `fetchResults()` are multiplied by an increasing factor (2x at threshold, growing as remaining approaches 0). This helps avoid 429 errors during long-running job polling.\n\n---\n\n## Credits\n\n- [A2Z WEB LTD](https://github.com/a2zwebltd)\n- [Dawid Makowski](https://github.com/makowskid)\n- Boost your [Laravel AI](https://sharpapi.com/) capabilities!\n\n---\n\n## License\n\nThe MIT License (MIT).\n\n---\n## Social Media\n\n🚀 For the latest news, tutorials, and case studies, don't forget to follow us on:\n- [SharpAPI X (formerly Twitter)](https://x.com/SharpAPI)\n- [SharpAPI YouTube](https://www.youtube.com/@SharpAPI)\n- [SharpAPI Vimeo](https://vimeo.com/SharpAPI)\n- [SharpAPI LinkedIn](https://www.linkedin.com/products/a2z-web-ltd-sharpapicom-automate-with-aipowered-api/)\n- [SharpAPI Facebook](https://www.facebook.com/profile.php?id=61554115896974)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpapi%2Fphp-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharpapi%2Fphp-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpapi%2Fphp-core/lists"}