zenapply / php-telephone
This package aims at providing an easy to use telephone data-type class
Installs: 6 973
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^5.5.9|^7.0
- giggsey/libphonenumber-for-php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^4.8|^5.0
This package is not auto-updated.
Last update: 2024-11-15 22:48:28 UTC
README
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!