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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mobile-numbers

Build Status

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
German DE
Denmark DK
Spain ES
Finland FI
France FR
Norway NO
Poland PL
Sweden SE
South Africa ZA

Feel free to to fork this project and add new countries.

How it works

Validate a phone number:

    Validator::country('ES')->isValid('651365485');

It is possible to validate phone numbers that contains the international country code:

    Validator::country('DK')->isValid('+4560514180');
    Validator::country('SE')->isValid('0046767164315');

The library provides helper that convert different phone number formats to E.164:

    $validator = Validator::country('PL');
    $raw_number = '(669) 823-955';

    $e164_number = $validator->helper->convertToE164($mobile_number);   // Convert number to "669823955"
    echo $validator->isValid($e164_number) ? 'Valid!' : 'Not Valid!');

    $validator = Validator::country('SE');
    $raw_number = '(+46) 7 37322 0-66';

    $e164_number = $validator->helper->convertToE164($mobile_number);   // Convert number to "+46737322066"
    echo $validator->isValid($e164_number) ? 'Valid!' : 'Not Valid!');

It is also possible to add a valid country code to number without country code:

    Validator::country('SE')->addCountryCode('0737321066');    // +46737321066
    Validator::country('DK')->addCountryCode('60515290');      // +4560515290

    Validator::country('DK')->addCountryCode('+4560515290');   // +4560515290  (Country code is not added again)
    Validator::country('DK')->addCountryCode('004560515290');  // 004560515290 (Country code is not added again)

or stripe the country code

    Validator::country('SE')->stripCountryCode('0046737321066');   // 0737321066
    Validator::country('FI')->stripCountryCode('00358411234567');  // 0411234567
    Validator::country('ES')->stripCountryCode('+34670862595');    // 670862595

Other methods:

    Validator::countr('ES')->helper->hasCountryCode('0030670862595'); // True
    Validator::country('ES')->hasValidCountryCode('0030670862595');  // False

Definitions list

Using the helper method "getAllDefinitions" it will obtain the information about the all the codes used in all the definitions:

    $definitions = Helper::getAllDefinitions();

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:

    Helper::identifyNumber('+4560514180');  // Returns DK

Add your country definition

  1. Fork this project
  2. Add a new definition into ./src/Definitions
  3. Add a new unit test into ./tests/Definitions

Backers and contributors


All versions of mobile-numbers with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package juanparati/mobile-numbers contains the following files

Loading the files please wait ....