1. Go to this page and download the library: Download kariha/tr-phone 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/ */
$phone = PhoneNumber::parse('0212 123 45 67');
$phone->isLandline(); // true
$phone->areaName(); // Istanbul Europe
$phone = PhoneNumber::parse('0532 123 45 67');
echo $phone->prefix(); // 532
echo $phone->prefixOperator(); // Turkcell
echo $phone->prefixService(); // Mobile electronic communication service
use Kariha\TrPhone\Exception\InvalidPhoneNumberException;
use Kariha\TrPhone\PhoneNumber;
try {
$phone = PhoneNumber::parse($input);
} catch (InvalidPhoneNumberException $exception) {
// Show a user-friendly validation message or log the reason.
}
$phone = PhoneNumber::tryParse($input);
if ($phone === null) {
// Invalid or unsupported number.
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.