1. Go to this page and download the library: Download brick/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/ */
brick / 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->isValidNumber()) {
// strict check relying on up-to-date metadata library
}
// or
if ($number->isPossibleNumber()) {
// a more lenient and faster check than `isValidNumber()`
}
PhoneNumber::parse('+33123456789')->getDescription(locale: 'en'); // France
PhoneNumber::parse('+16509030000')->getDescription(locale: 'en'); // Mountain View, CA
$number = PhoneNumber::parse('+336789012345');
$number->getCarrierName(languageCode: 'en'); // Orange France
// null, because France supports mobile number portability
$number->getCarrierName(languageCode: 'en', mode: CarrierNameMode::MOBILE_NO_PORTABILITY_ONLY);