zenapply/php-telephone

This package aims at providing an easy to use telephone data-type class

1.0.1 2016-05-16 01:59 UTC

This package is not auto-updated.

Last update: 2024-04-19 20:24:44 UTC


README

Latest Version Software License Build Status Scrutinizer Code Quality Code Coverage Dependency Status Total Downloads

This package aims at providing an easy to use telephone data-type class.

Installation

Install via composer - In the terminal:

composer require zenapply/php-telephone

Usage

use Zenapply\DataTypes\Telephone;

$phone = new Telephone('+1 (230) 555-3333', 'US'); // The second parameter (region) is optional and defaults to 'US'.

echo $phone . PHP_EOL;                      // +12305553333
echo $phone->getE164() . PHP_EOL;           // +12305553333
echo $phone->getRFC3966() . PHP_EOL;        // tel:+1-230-555-3333
echo $phone->getNational() . PHP_EOL;       // (230) 555-3333
echo $phone->getInternational() . PHP_EOL;  // +1 230-555-3333
echo $phone->getOriginal() . PHP_EOL;       // +1 (230) 555-3333
echo $phone->getAreaCode() . PHP_EOL;       // 230
echo $phone->getCountryCode() . PHP_EOL;    // 1
echo $phone->getSubscriberCode() . PHP_EOL; // 5553333
echo $phone->isValid() . PHP_EOL;           // true

Contributing

Contributions are always welcome!