proficlos/phonenumber

Czech PhoneNumber validator & parser

v1.0.1 2018-10-02 14:07 UTC

This package is auto-updated.

Last update: 2024-05-29 03:22:28 UTC


README

GitHub version travis-ci.com codecov.io

PhoneNumber validator & parser (CZ & SK & ...)

Install with composer

$ composer require proficlos/phonenumber

How to use

use ProfiCloS\Tools\PhoneNumber;

// validation
PhoneNumber::isPhone('+420777666555'); // true
PhoneNumber::isPhone('777666555'); // true
PhoneNumber::isPhone('77766655'); // false

// parser
$phone = PhoneNumber::from('+420777666555');

$phone->setFormat( PhoneNumber::FORMAT_INTERNATIONAL );
echo $phone; // 00420777666555

$phone->setFormat( PhoneNumber::FORMAT_GSM );
echo $phone; // +420777666555

$phone->setFormat( PhoneNumber::FORMAT_CANONICAL );
echo $phone; // +420 777 666 555

Buy us a coffee <3

Buy me a Coffee

Donate us <3

ETH: 0x7D771A56735500f76af15F589155BDC91613D4aB
UBIQ: 0xAC08C7B9F06EFb42a603d7222c359e0fF54e0a13