Search by

eram / abzar

navidk

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

Package info

github.com/eramhq/abzar-php

pkg:composer/eram/abzar

Statistics

Installs: 2 187

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 2

0.8.1 2026-10-08 09:35 UTC

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

MIT; see LICENSE. Some algorithms and lookup tables derive from the MIT-licensed persian-tools project. See Contributing to help.