PHP code example of leadsolution / phone-number-normalizer

1. Go to this page and download the library: Download leadsolution/phone-number-normalizer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leadsolution / phone-number-normalizer example snippets


use Leadsolution\PhoneNumber\Normalizer;
$normalizer = new Normalizer();

$normalizer->normalize('2345-6789')->toString();
// 23456789

$normalizer->normalize('(11) 2345-6789')->toString();
// 1123456789 

$normalizer->normalize('2345-6789', '11')->toString();
// 1123456789 

$normalizer->normalize('+55 (11) 2345-6789')->toString();
// 1123456789 

$normalizer->normalize('7345-6789', '11')->toString();
// 11973456789 

$normalizer->normalize('987654321')->isMobile();
// true

$normalizer->normalize('23456789')->isMobile();
// false