eram / abzar
Zero-runtime-dependency Persian (Farsi) toolkit for PHP 8.1+: validators for national ID, legal ID, bank card, Sheba/IBAN, phone, postal code, bill ID and license plate; Toman/Rial money with an Amount value object; formatters (number to words and back, ordinals, time-ago); text tools (slug, script
Requires
- php: >=8.1
- ext-mbstring: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- infection/infection: ^0.29
- phpbench/phpbench: ^1.3
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.5
Suggests
- ext-intl: Required for PersianCollator and CharNormalizer::normalizeToNfc (Unicode NFC normalization); everything else is pure PHP.
- eram/daynum: Jalali / Shamsi calendar utilities (date parsing, month names, conversions) — companion to abzar.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-16 23:13:41 UTC
README
Persian text, digits, number formatting, Iranian validators, and rial/toman money tools for PHP 8.1+. No third-party Composer packages are required at runtime. PHP's mbstring extension is required; intl is optional for Persian sorting and NFC normalization.
Install
composer require 'eram/abzar:^0.8.1'
Abzar remains pre-1.0 (0.x); minor releases may break compatibility. Release 0.8.1 has no prerelease suffix. The constraint above stays below 0.9. Review the stability policy before upgrading.
Quick start
Save as example.php next to vendor/ and run php example.php.
<?php require 'vendor/autoload.php'; use Eram\Abzar\Validation\PhoneNumber; use Eram\Abzar\Money\Amount; use Eram\Abzar\Money\Currency; $phone = PhoneNumber::from('+98 912 123 4567'); echo $phone->value(), "\n"; echo Currency::format(Amount::fromRials(12_345)), "\n";
09121234567
۱،۲۳۴.۵ تومان
Validation checks structure and, where applicable, checksums. It does not prove ownership, identity, account existence, or phone reachability.
Documentation
- English documentation · مستندات فارسی
- Installation · Validation · Errors and warnings
- Persian text · Digits · Formatting · Money
- Framework integration · Upgrade guide · Changelog
MIT; see LICENSE. Some algorithms and lookup tables derive from the MIT-licensed persian-tools project. See Contributing to help.