Download the PHP package juanparati/mobile-numbers without Composer
On this page you can find all versions of the php package juanparati/mobile-numbers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download juanparati/mobile-numbers
More information about juanparati/mobile-numbers
Files in juanparati/mobile-numbers
Package mobile-numbers
Short Description An international mobile number validator
License GPL-3.0-or-later
Informations about the package mobile-numbers
MobileNumbers
What is it?
A library that validate and parse mobile phone numbers.
Right now only phone numbers from the following countries are validated:
| Country | Code |
|---|---|
| Germany | DE |
| Denmark | DK |
| Spain | ES |
| Finland | FI |
| France | FR |
| United Kingdom | GB |
| Ireland | IE |
| Italy | IT |
| Norway | NO |
| Poland | PL |
| Sweden | SE |
| South Africa | ZA |
Feel free to fork this project and add new countries.
Installation
composer require juanparati/mobile-numbers
How it works
Validate a phone number:
It is possible to validate phone numbers that contains the international country code:
The library provides helper that convert different phone number formats to E.164:
It is also possible to add a valid country code to number without country code:
or stripe the country code
Other methods:
Definitions list
Using the helper method "getAllDefinitions" it will obtain the information about the all the codes used in all the definitions:
The definitions include country prefix code, country code and country flag information.
Identify phone numbers
Using the helper method "identifyNumber" is possible the identify the country which belongs the phone number. The phone number should contains the international prefix.
Example:
Add your country definition
- Fork this project
- Add a new definition into ./src/Definitions
- Add a new unit test into ./tests/Definitions
Backers and contributors
- Matchbanker.fi (Backer)