PHPackages                             shankar/country-phone-validator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. shankar/country-phone-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

shankar/country-phone-validator
===============================

Laravel package to validate phone numbers using country name or dial code

v1.0.1(1y ago)021MITPHP

Since Jun 28Pushed 2mo agoCompare

[ Source](https://github.com/Shankar-Tom/country-phone-validator)[ Packagist](https://packagist.org/packages/shankar/country-phone-validator)[ RSS](/packages/shankar-country-phone-validator/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

country-phone-validator
=======================

[](#country-phone-validator)

A Laravel package for validating mobile phone numbers across different countries with additional features.

Features
--------

[](#features)

- Validate phone numbers for 200+ countries
- Check if a number belongs to a specific country
- Get country code from phone number
- Format phone numbers according to international standards
- Support for custom validation rules
- Easy integration with Laravel validation system

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

[](#installation)

You can install this package via Composer:

```
composer require shankar/country-phone-validator
```

The package will be auto-discovered by Laravel. If you are not using package auto-discovery, add the service provider to your `config/app.php`:

```
'providers' => [
    // ...
    Shankar\CountryPhoneValidator\CountryPhoneValidatorServiceProvider::class,
],
```

Usage
-----

[](#usage)

### Basic Phone Number Validation

[](#basic-phone-number-validation)

```
use Shankar\CountryPhoneValidator\Rules\PhoneNumber;

$request->validate([
    'phone' => ['required', new PhoneNumber],
]);
```

### Validate by Country Name

[](#validate-by-country-name)

```
use Shankar\CountryPhoneValidator\Rules\ValidPhoneByCountryName;

$request->validate([
    'phone' => ['required', new ValidPhoneByCountryName('India')],
]);
```

### Validate by Dial Code

[](#validate-by-dial-code)

```
use Shankar\CountryPhoneValidator\Rules\ValidPhoneByDialCode;

$request->validate([
    'phone' => ['required', new ValidPhoneByDialCode('+91')],
]);
```

Country Names and Dial Codes
----------------------------

[](#country-names-and-dial-codes)

You can retrieve the list of supported countries with their dial codes and validation regex using the `Countries` class:

```
use Shankar\CountryPhoneValidator\Countries;

$countries = Countries::all();
// Example output:
// [
//     [
//         'name' => 'India',
//         'dial_code' => '+91',
//         'regex' => '/^...$/'
//     ],
//     ...
// ]
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance69

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

372d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/68939188?v=4)[Shankar Gorai](/maintainers/Shankar-Tom)[@Shankar-Tom](https://github.com/Shankar-Tom)

---

Top Contributors

[![Shankar-Tom](https://avatars.githubusercontent.com/u/68939188?v=4)](https://github.com/Shankar-Tom "Shankar-Tom (5 commits)")

### Embed Badge

![Health badge](/badges/shankar-country-phone-validator/health.svg)

```
[![Health](https://phpackages.com/badges/shankar-country-phone-validator/health.svg)](https://phpackages.com/packages/shankar-country-phone-validator)
```

###  Alternatives

[marcosh/php-validation-dsl

A DSL for validating data in a functional fashion

483.9k](/packages/marcosh-php-validation-dsl)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
