PHPackages                             mmae/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mmae/phones

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mmae/phones
===========

Phone class that make dealing with phone numbers easy

1.0.0(1y ago)216MITPHP

Since Jul 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Mahmoud1478/MMAE-Phones)[ Packagist](https://packagist.org/packages/mmae/phones)[ RSS](/packages/mmae-phones/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

mmae/phones
===========

[](#mmaephones)

Laravel package for validating and normalizing phone numbers, with a matching set of validation rules.

- **209 countries** — one `{CODE}Phone` class and one `{CODE}PhoneRule` per entry in `config/phones.php`.
- Normalizes any accepted shape (local `0`, `00`, `+`, bare dialing code) to a single canonical form.
- Drop-in Laravel `ValidationRule`s with `exists`/`unique` database checks, nullable/empty handling, custom messages, translations, and a full-control callback.

1. Supported Countries
----------------------

[](#1-supported-countries)

**209 countries**, each with the full feature set. Every entry in `config/phones.php` ships all four of:

- **Phone** — a `{CODE}Phone` class (`MMAE\Phones\Phones\`) for validation/normalization (§3, §5).
- **Rule** — a `{CODE}PhoneRule` validation rule (`MMAE\Phones\Rules\`, §4).
- **Placeholder** — a `{CODE}Placeholder` for UI hints/masks (`MMAE\Phones\Placeholders\`, §7).
- **Detector** — `CountryDetector` support (§6), enabled whenever the config entry has a `key` and `pattern`.

Legend: ✅ supported · — not generated.

> All 209 bundled countries are ✅ across every column. The columns matter once you **extend the config yourself**: a country you add to `config/phones.php` gets **Detector** support immediately (it reads config directly), but its `{CODE}Phone` / `{CODE}PhoneRule` / `{CODE}Placeholder` classes only exist after you add them (§8 → *Adding a new country*). Run `php artisan config:show phones` to list your live codes.

**Full support matrix (209 countries)**CountryCodePhoneRulePlaceholderDetectorAndorra`AD`✅✅✅✅United Arab Emirates`AE`✅✅✅✅Afghanistan`AF`✅✅✅✅Antigua &amp; Barbuda`AG`✅✅✅✅Anguilla`AI`✅✅✅✅Albania`AL`✅✅✅✅Armenia`AM`✅✅✅✅Angola`AO`✅✅✅✅Argentina`AR`✅✅✅✅American Samoa`AS`✅✅✅✅Austria`AT`✅✅✅✅Australia`AU`✅✅✅✅Azerbaijan`AZ`✅✅✅✅Bosnia &amp; Herzegovina`BA`✅✅✅✅Barbados`BB`✅✅✅✅Bangladesh`BD`✅✅✅✅Belgium`BE`✅✅✅✅Burkina Faso`BF`✅✅✅✅Bulgaria`BG`✅✅✅✅Bahrain`BH`✅✅✅✅Burundi`BI`✅✅✅✅Benin`BJ`✅✅✅✅Bermuda`BM`✅✅✅✅Brunei`BN`✅✅✅✅Bolivia`BO`✅✅✅✅Brazil`BR`✅✅✅✅Bahamas`BS`✅✅✅✅Bhutan`BT`✅✅✅✅Botswana`BW`✅✅✅✅Belarus`BY`✅✅✅✅Belize`BZ`✅✅✅✅Canada`CA`✅✅✅✅Congo - Kinshasa`CD`✅✅✅✅Central African Republic`CF`✅✅✅✅Congo - Brazzaville`CG`✅✅✅✅Switzerland`CH`✅✅✅✅Côte d’Ivoire`CI`✅✅✅✅Chile`CL`✅✅✅✅Cameroon`CM`✅✅✅✅China`CN`✅✅✅✅Colombia`CO`✅✅✅✅Costa Rica`CR`✅✅✅✅Cuba`CU`✅✅✅✅Cape Verde`CV`✅✅✅✅Cyprus`CY`✅✅✅✅Czechia`CZ`✅✅✅✅Germany`DE`✅✅✅✅Djibouti`DJ`✅✅✅✅Denmark`DK`✅✅✅✅Dominica`DM`✅✅✅✅Dominican Republic`DO`✅✅✅✅Algeria`DZ`✅✅✅✅Ecuador`EC`✅✅✅✅Estonia`EE`✅✅✅✅Egypt`EG`✅✅✅✅Eritrea`ER`✅✅✅✅Spain`ES`✅✅✅✅Ethiopia`ET`✅✅✅✅Finland`FI`✅✅✅✅Fiji`FJ`✅✅✅✅Faroe Islands`FO`✅✅✅✅France`FR`✅✅✅✅Gabon`GA`✅✅✅✅United Kingdom`GB`✅✅✅✅Grenada`GD`✅✅✅✅Georgia`GE`✅✅✅✅Ghana`GH`✅✅✅✅Gibraltar`GI`✅✅✅✅Greenland`GL`✅✅✅✅Gambia`GM`✅✅✅✅Guinea`GN`✅✅✅✅Equatorial Guinea`GQ`✅✅✅✅Greece`GR`✅✅✅✅Guatemala`GT`✅✅✅✅Guam`GU`✅✅✅✅Guinea-Bissau`GW`✅✅✅✅Guyana`GY`✅✅✅✅Hong Kong SAR China`HK`✅✅✅✅Honduras`HN`✅✅✅✅Croatia`HR`✅✅✅✅Haiti`HT`✅✅✅✅Hungary`HU`✅✅✅✅Indonesia`ID`✅✅✅✅Ireland`IE`✅✅✅✅Israel`IL`✅✅✅✅India`IN`✅✅✅✅Iraq`IQ`✅✅✅✅Iran`IR`✅✅✅✅Iceland`IS`✅✅✅✅Italy`IT`✅✅✅✅Jamaica`JM`✅✅✅✅Jordan`JO`✅✅✅✅Japan`JP`✅✅✅✅Kenya`KE`✅✅✅✅Kyrgyzstan`KG`✅✅✅✅Cambodia`KH`✅✅✅✅Comoros`KM`✅✅✅✅St. Kitts &amp; Nevis`KN`✅✅✅✅North Korea`KP`✅✅✅✅South Korea`KR`✅✅✅✅Kuwait`KW`✅✅✅✅Cayman Islands`KY`✅✅✅✅Kazakhstan`KZ`✅✅✅✅Laos`LA`✅✅✅✅Lebanon`LB`✅✅✅✅St. Lucia`LC`✅✅✅✅Liechtenstein`LI`✅✅✅✅Sri Lanka`LK`✅✅✅✅Liberia`LR`✅✅✅✅Lesotho`LS`✅✅✅✅Lithuania`LT`✅✅✅✅Luxembourg`LU`✅✅✅✅Latvia`LV`✅✅✅✅Libya`LY`✅✅✅✅Morocco`MA`✅✅✅✅Monaco`MC`✅✅✅✅Moldova`MD`✅✅✅✅Montenegro`ME`✅✅✅✅Madagascar`MG`✅✅✅✅North Macedonia`MK`✅✅✅✅Mali`ML`✅✅✅✅Myanmar (Burma)`MM`✅✅✅✅Mongolia`MN`✅✅✅✅Macao SAR China`MO`✅✅✅✅Northern Mariana Islands`MP`✅✅✅✅Mauritania`MR`✅✅✅✅Montserrat`MS`✅✅✅✅Malta`MT`✅✅✅✅Mauritius`MU`✅✅✅✅Maldives`MV`✅✅✅✅Malawi`MW`✅✅✅✅Mexico`MX`✅✅✅✅Malaysia`MY`✅✅✅✅Mozambique`MZ`✅✅✅✅Namibia`NA`✅✅✅✅New Caledonia`NC`✅✅✅✅Niger`NE`✅✅✅✅Nigeria`NG`✅✅✅✅Nicaragua`NI`✅✅✅✅Netherlands`NL`✅✅✅✅Norway`NO`✅✅✅✅Nepal`NP`✅✅✅✅New Zealand`NZ`✅✅✅✅Oman`OM`✅✅✅✅Panama`PA`✅✅✅✅Peru`PE`✅✅✅✅French Polynesia`PF`✅✅✅✅Papua New Guinea`PG`✅✅✅✅Philippines`PH`✅✅✅✅Pakistan`PK`✅✅✅✅Poland`PL`✅✅✅✅Puerto Rico`PR`✅✅✅✅Palestinian Territories`PS`✅✅✅✅Portugal`PT`✅✅✅✅Paraguay`PY`✅✅✅✅Qatar`QA`✅✅✅✅Romania`RO`✅✅✅✅Serbia`RS`✅✅✅✅Russia`RU`✅✅✅✅Rwanda`RW`✅✅✅✅Saudi Arabia`SA`✅✅✅✅Solomon Islands`SB`✅✅✅✅Seychelles`SC`✅✅✅✅Sudan`SD`✅✅✅✅Sweden`SE`✅✅✅✅Singapore`SG`✅✅✅✅Slovenia`SI`✅✅✅✅Slovakia`SK`✅✅✅✅Sierra Leone`SL`✅✅✅✅San Marino`SM`✅✅✅✅Senegal`SN`✅✅✅✅Somalia`SO`✅✅✅✅Suriname`SR`✅✅✅✅South Sudan`SS`✅✅✅✅São Tomé &amp; Príncipe`ST`✅✅✅✅El Salvador`SV`✅✅✅✅Sint Maarten`SX`✅✅✅✅Syria`SY`✅✅✅✅Eswatini`SZ`✅✅✅✅Turks &amp; Caicos Islands`TC`✅✅✅✅Chad`TD`✅✅✅✅Togo`TG`✅✅✅✅Thailand`TH`✅✅✅✅Tajikistan`TJ`✅✅✅✅Timor-Leste`TL`✅✅✅✅Turkmenistan`TM`✅✅✅✅Tunisia`TN`✅✅✅✅Tonga`TO`✅✅✅✅Türkiye`TR`✅✅✅✅Trinidad &amp; Tobago`TT`✅✅✅✅Taiwan`TW`✅✅✅✅Tanzania`TZ`✅✅✅✅Ukraine`UA`✅✅✅✅Uganda`UG`✅✅✅✅United States`US`✅✅✅✅Uruguay`UY`✅✅✅✅Uzbekistan`UZ`✅✅✅✅St. Vincent &amp; Grenadines`VC`✅✅✅✅Venezuela`VE`✅✅✅✅British Virgin Islands`VG`✅✅✅✅U.S. Virgin Islands`VI`✅✅✅✅Vietnam`VN`✅✅✅✅Vanuatu`VU`✅✅✅✅Samoa`WS`✅✅✅✅Kosovo`XK`✅✅✅✅Yemen`YE`✅✅✅✅South Africa`ZA`✅✅✅✅Zambia`ZM`✅✅✅✅Zimbabwe`ZW`✅✅✅✅2. Installation
---------------

[](#2-installation)

```
composer require mmae/phones
```

Config and translations are merged/loaded automatically — no publish needed to start.

3. Usage
--------

[](#3-usage)

### Validate a known-country number before saving

[](#validate-a-known-country-number-before-saving)

```
