PHPackages                             sharpapi/laravel-content-detect-phones - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sharpapi/laravel-content-detect-phones

ActiveLibrary[API Development](/categories/api)

sharpapi/laravel-content-detect-phones
======================================

AI Phone Number Detection for Laravel powered by SharpAPI.com

v1.0.3(1mo ago)11MITPHPPHP ^8.1

Since Jun 16Pushed 1mo agoCompare

[ Source](https://github.com/sharpapi/laravel-content-detect-phones)[ Packagist](https://packagist.org/packages/sharpapi/laravel-content-detect-phones)[ Docs](https://github.com/sharpapi/laravel-content-detect-phones)[ RSS](/packages/sharpapi-laravel-content-detect-phones/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (5)Used By (0)

[![SharpAPI GitHub cover](https://camo.githubusercontent.com/82bb36706c1e71276b3dca4ec9120353bb51c8f22bb62543bf056db5c28da36d/68747470733a2f2f73686172706170692e636f6d2f73686172706170692d6769746875622d6c61726176656c2d62672e6a7067 "SharpAPI Laravel Client")](https://camo.githubusercontent.com/82bb36706c1e71276b3dca4ec9120353bb51c8f22bb62543bf056db5c28da36d/68747470733a2f2f73686172706170692e636f6d2f73686172706170692d6769746875622d6c61726176656c2d62672e6a7067)

AI Phone Number Detection for Laravel
=====================================

[](#ai-phone-number-detection-for-laravel)

🚀 Leverage AI API to detect and parse phone numbers in text content.
--------------------------------------------------------------------

[](#-leverage-ai-api-to-detect-and-parse-phone-numbers-in-text-content)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2b5b9f75626065ebda186bdb4204a3fe3e6c9fb2b125ff2904cd1ef34deab68b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73686172706170692f6c61726176656c2d636f6e74656e742d6465746563742d70686f6e65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sharpapi/laravel-content-detect-phones)[![Total Downloads](https://camo.githubusercontent.com/6bb4b1e03649d33bc4200bf10201c7b4389b10fb62f0317dc427f16a8e8a9233/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73686172706170692f6c61726176656c2d636f6e74656e742d6465746563742d70686f6e65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sharpapi/laravel-content-detect-phones)

Check the details at SharpAPI's [AI Phone Numbers Detector API](https://sharpapi.com/en/catalog/ai/content-marketing-automation/phone-numbers-detector) page.

---

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Laravel &gt;= 10.48.29

---

Installation
------------

[](#installation)

Follow these steps to install and set up the SharpAPI Laravel Phone Number Detection package.

1. Install the package via `composer`:

```
composer require sharpapi/laravel-content-detect-phones
```

2. Register at [SharpAPI.com](https://sharpapi.com/) to obtain your API key.
3. Set the API key in your `.env` file:

```
SHARP_API_KEY=your_api_key_here
```

4. **\[OPTIONAL\]** Publish the configuration file:

```
php artisan vendor:publish --tag=sharpapi-content-detect-phones
```

---

Key Features
------------

[](#key-features)

- **AI-Powered Phone Number Detection**: Efficiently detect phone numbers in any text content.
- **E.164 Format Conversion**: Automatically converts detected phone numbers to standardized E.164 format.
- **Multiple Number Detection**: Identifies all phone numbers present in the provided text.
- **International Number Support**: Recognizes phone numbers from different countries and formats.
- **Robust Polling for Results**: Polling-based API response handling with customizable intervals.
- **API Availability and Quota Check**: Check API availability and current usage quotas with SharpAPI's endpoints.

---

Usage
-----

[](#usage)

You 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.

### Basic Workflow

[](#basic-workflow)

1. **Dispatch Job**: Send text content to the API using `detectPhones`, which returns a status URL.
2. **Poll for Results**: Use `fetchResults($statusUrl)` to poll until the job completes or fails.
3. **Process Result**: After completion, retrieve the results from the `SharpApiJob` object returned.

> **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.

---

### Controller Example

[](#controller-example)

Here is an example of how to use `ContentDetectPhonesService` within a Laravel controller:

```
