{"id":28927964,"url":"https://github.com/sharpapi/laravel-content-detect-phones","last_synced_at":"2026-05-15T12:06:02.372Z","repository":{"id":299440567,"uuid":"1003055014","full_name":"sharpapi/laravel-content-detect-phones","owner":"sharpapi","description":"AI Phone Number Detection for Laravel","archived":false,"fork":false,"pushed_at":"2026-03-28T04:15:35.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-28T09:37:15.826Z","etag":null,"topics":["ai","api","laravel","phone-detection","phone-detector","sharpapi"],"latest_commit_sha":null,"homepage":"https://sharpapi.com/en/catalog/ai/content-marketing-automation/phone-numbers-detector","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/sharpapi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2025-06-16T14:51:49.000Z","updated_at":"2026-03-28T04:15:38.000Z","dependencies_parsed_at":"2025-06-16T15:55:24.313Z","dependency_job_id":null,"html_url":"https://github.com/sharpapi/laravel-content-detect-phones","commit_stats":null,"previous_names":["sharpapi/laravel-content-detect-phones"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sharpapi/laravel-content-detect-phones","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-content-detect-phones","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-content-detect-phones/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-content-detect-phones/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-content-detect-phones/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharpapi","download_url":"https://codeload.github.com/sharpapi/laravel-content-detect-phones/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-content-detect-phones/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33066149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ai","api","laravel","phone-detection","phone-detector","sharpapi"],"created_at":"2025-06-22T14:11:27.524Z","updated_at":"2026-05-15T12:06:02.366Z","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# AI Phone Number Detection for Laravel\n\n## 🚀 Leverage AI API to detect and parse phone numbers in text content.\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/sharpapi/laravel-content-detect-phones.svg?style=flat-square)](https://packagist.org/packages/sharpapi/laravel-content-detect-phones)\n[![Total Downloads](https://img.shields.io/packagist/dt/sharpapi/laravel-content-detect-phones.svg?style=flat-square)](https://packagist.org/packages/sharpapi/laravel-content-detect-phones)\n\nCheck the details at SharpAPI's [AI Phone Numbers Detector API](https://sharpapi.com/en/catalog/ai/content-marketing-automation/phone-numbers-detector) page.\n\n---\n\n## Requirements\n\n- PHP \u003e= 8.1\n- Laravel \u003e= 10.48.29\n\n---\n\n## Installation\n\nFollow these steps to install and set up the SharpAPI Laravel Phone Number Detection package.\n\n1. Install the package via `composer`:\n\n```bash\ncomposer require sharpapi/laravel-content-detect-phones\n```\n\n2. Register at [SharpAPI.com](https://sharpapi.com/) to obtain your API key.\n\n3. Set the API key in your `.env` file:\n\n```bash\nSHARP_API_KEY=your_api_key_here\n```\n\n4. **[OPTIONAL]** Publish the configuration file:\n\n```bash\nphp artisan vendor:publish --tag=sharpapi-content-detect-phones\n```\n\n---\n## Key Features\n\n- **AI-Powered Phone Number Detection**: Efficiently detect phone numbers in any text content.\n- **E.164 Format Conversion**: Automatically converts detected phone numbers to standardized E.164 format.\n- **Multiple Number Detection**: Identifies all phone numbers present in the provided text.\n- **International Number Support**: Recognizes phone numbers from different countries and formats.\n- **Robust Polling for Results**: Polling-based API response handling with customizable intervals.\n- **API Availability and Quota Check**: Check API availability and current usage quotas with SharpAPI's endpoints.\n\n---\n\n## Usage\n\nYou can inject the `ContentDetectPhonesService` class to access phone number detection functionality. For best results, especially with batch processing, use Laravel's queuing system to optimize job dispatch and result polling.\n\n### Basic Workflow\n\n1. **Dispatch Job**: Send text content to the API using `detectPhones`, which returns a status URL.\n2. **Poll for Results**: Use `fetchResults($statusUrl)` to poll until the job completes or fails.\n3. **Process Result**: After completion, retrieve the results from the `SharpApiJob` object returned.\n\n\u003e **Note**: Each job typically takes a few seconds to complete. Once completed successfully, the status will update to `success`, and you can process the results as JSON, array, or object format.\n\n---\n\n### Controller Example\n\nHere is an example of how to use `ContentDetectPhonesService` within a Laravel controller:\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse GuzzleHttp\\Exception\\GuzzleException;\nuse SharpAPI\\ContentDetectPhones\\ContentDetectPhonesService;\n\nclass ContentController extends Controller\n{\n    protected ContentDetectPhonesService $phoneDetectionService;\n\n    public function __construct(ContentDetectPhonesService $phoneDetectionService)\n    {\n        $this-\u003ephoneDetectionService = $phoneDetectionService;\n    }\n\n    /**\n     * @throws GuzzleException\n     */\n    public function detectPhoneNumbers(string $text)\n    {\n        $statusUrl = $this-\u003ephoneDetectionService-\u003edetectPhones($text);\n        \n        $result = $this-\u003ephoneDetectionService-\u003efetchResults($statusUrl);\n\n        return response()-\u003ejson($result-\u003egetResultJson());\n    }\n}\n```\n\n### Handling Guzzle Exceptions\n\nAll requests are managed by Guzzle, so it's helpful to be familiar with [Guzzle Exceptions](https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions).\n\nExample:\n\n```php\nuse GuzzleHttp\\Exception\\ClientException;\n\ntry {\n    $statusUrl = $this-\u003ephoneDetectionService-\u003edetectPhones('Contact us at +1 (800) 555-1234 or 555-6789');\n} catch (ClientException $e) {\n    echo $e-\u003egetMessage();\n}\n```\n\n---\n\n## Optional Configuration\n\nYou can customize the configuration by setting the following environment variables in your `.env` file:\n\n```bash\nSHARP_API_KEY=your_api_key_here\nSHARP_API_JOB_STATUS_POLLING_WAIT=180\nSHARP_API_JOB_STATUS_USE_POLLING_INTERVAL=true\nSHARP_API_JOB_STATUS_POLLING_INTERVAL=10\nSHARP_API_BASE_URL=https://sharpapi.com/api/v1\n```\n\n---\n\n## Phone Number Detection Data Format Example\n\n```json\n{\n  \"data\": {\n    \"type\": \"api_job_result\",\n    \"id\": \"d43b36dc-3d1d-4ba7-9a17-36a438d91f09\",\n    \"attributes\": {\n      \"status\": \"success\",\n      \"type\": \"content_detect_phones\",\n      \"result\": [\n        {\n          \"parsed_number\": \"+18003947486\",\n          \"detected_number\": \"1800-394-7486\"\n        },\n        {\n          \"parsed_number\": \"+6588888888\",\n          \"detected_number\": \"+65 8888 8888\"\n        }\n      ]\n    }\n  }\n}\n```\n\n---\n\n## Support \u0026 Feedback\n\nFor issues or suggestions, please:\n\n- [Open an issue on GitHub](https://github.com/sharpapi/laravel-content-detect-phones/issues)\n- Join our [Telegram community](https://t.me/sharpapi_community)\n\n---\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for a detailed list of changes.\n\n---\n\n## Credits\n\n- [A2Z WEB LTD](https://github.com/a2zwebltd)\n- [Dawid Makowski](https://github.com/makowskid)\n- Enhance your [Laravel AI](https://sharpapi.com/) capabilities!\n\n---\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n---\n\n## Follow Us\n\nStay updated with news, tutorials, and case studies:\n\n- [SharpAPI on X (Twitter)](https://x.com/SharpAPI)\n- [SharpAPI on YouTube](https://www.youtube.com/@SharpAPI)\n- [SharpAPI on Vimeo](https://vimeo.com/SharpAPI)\n- [SharpAPI on LinkedIn](https://www.linkedin.com/products/a2z-web-ltd-sharpapicom-automate-with-aipowered-api/)\n- [SharpAPI on Facebook](https://www.facebook.com/profile.php?id=61554115896974)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpapi%2Flaravel-content-detect-phones","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharpapi%2Flaravel-content-detect-phones","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpapi%2Flaravel-content-detect-phones/lists"}