Input
Customer contact details
- Phone number entered by the customer
- ۰۹۱۲ ۱۲۳ ۴۵۶۷
A sample contact field. Compare different ways of entering a number.
Abzar output
Returned by the library
From input to useful output.
Reveal the result to see what Abzar returns for this exact example.
Valid structure
- Consistent local value
- 09121234567
- International value · E.164
- +989121234567
- Readable display
- 0912 123 4567
Persian and international inputs become the same local value. No need to ask people to retype their number.
</>PHP for this exact example
use Eram\Abzar\Validation\PhoneNumber;
$result = PhoneNumber::validate('۰۹۱۲ ۱۲۳ ۴۵۶۷');
$result->isValid();
$result->errorCodes();
$result->warningCodes();
$phone = PhoneNumber::tryFrom('۰۹۱۲ ۱۲۳ ۴۵۶۷');
$phone?->value();
$phone?->e164();