1. Go to this page and download the library: Download rdtvaacar/phonenumber 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/ */
rdtvaacar / phonenumber example snippets
use Brick\PhoneNumber\PhoneNumber;
use Brick\PhoneNumber\PhoneNumberParseException;
try {
$number = PhoneNumber::parse('+333');
}
catch (PhoneNumberParseException $e) {
// 'The string supplied is too short to be a phone number.'
}
if (! $number->isPossibleNumber()) {
// a more lenient and faster check than `isValidNumber()`
}
if (! $number->isValidNumber()) {
// strict check relying on up-to-date metadata library
}