Download the PHP package eram/abzar without Composer

On this page you can find all versions of the php package eram/abzar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package abzar

Abzar

Zero-runtime-dependency Persian (Farsi) utility toolkit for PHP 8.1+.

Abzar (ابزار, "tool") is a pure-PHP library covering the small but opinionated set of utilities every Persian-language application ends up reimplementing: national-ID / IBAN / bank-card / phone validation, number-to-words and time-ago formatting, Persian slug generation, script detection, and digit conversion between Persian, Arabic, and English.

No framework coupling, no runtime extensions beyond stock PHP, no transitive Composer dependencies.

Messages and error codes. Persian error messages are byte-identical to the upstream data. For language-neutral error handling, every validator failure also emits a machine-readable ErrorCode:

Error-code values are stable API surface as of 0.3 — renaming a case is a breaking change.

Exception hierarchy. Every thrown exception extends Eram\Abzar\Exception\AbzarException (abstract; carries errorCode(): ErrorCode). Three concrete subclasses: ValidationException (thrown by ::from()), FormatException (thrown by formatters), and EnvironmentException (thrown when an optional extension like ext-intl is missing at runtime). Catch the base to handle every library failure uniformly.

Feature matrix

Namespace Class What it does
Validation NationalId Iranian national-ID checksum + city / province lookup
Validation LegalId 11-digit Iranian legal-entity ID checksum
Validation PhoneNumber Iranian mobile + landline number validation, operator / area-code detection (09xx, +98, 0098, 98)
Validation CardNumber 16-digit bank card Luhn check + bank name from BIN
Validation Iban IR-prefixed IBAN mod-97 check + bank lookup
Validation PostalCode 10-digit Iranian postal code validator
Validation BillId شناسه قبض / شناسه پرداخت mod-11 pair validator with bill-type decoding
Validation PlateNumber Iranian license plate (NN[letter]NNN-NN) parser with letter-derived type + province lookup
Validation ErrorCode Stable DOMAIN.REASON codes emitted by every validator + format exception
Validation Bank / Operator / Province / PlateType Typed enums with fromPersian() lookup and Arabic-char-tolerant matching
Validation ValidationResult Shared {isValid, errors, errorCodes, warnings, detail} return type (implements JsonSerializable / Stringable)
Validation\Details ValidationDetail Marker interface for the per-validator readonly DTOs returned from ValidationResult::detail()
Format NumberFormatter Thousands-separator formatter with digit normalization
Format NumberToWords Integer / float to Persian words (۱۲۳۴یک هزار و دویست و سی و چهار)
Format WordsToNumber Parse Persian number words back to int / float
Format OrdinalNumber Persian ordinals: toWord(3)سوم, toShort(43)۴۳ام
Format TimeAgo Fuzzy relative time in Persian (۵ دقیقه پیش, حدود ۳ روز پیش)
Money Amount Immutable Iranian-currency value object; stores rials internally, factories / accessors for both units
Money Currency / Unit Toman / Rial formatter and ×10 / ÷10 converter
Text Script isPersian / hasPersian / isArabic / hasArabic detectors
Text Slug Persian-aware slug (سلام دنیاسلام-دنیا)
Text CharNormalizer Arabic → Persian char + digit normalization, HTML-aware normalizeContent(), opt-in hamza / tashkeel / kashida / NFC flags
Text KeyboardFixer Swap between English QWERTY and Persian keyboard layouts, with a detect() heuristic
Text PersianCollator ext-intl-backed fa_IR collator with sort / sortBy helpers
Text HalfSpaceFixer Best-effort zero-width-non-joiner placement for compound-word affixes (می‌روم, خانه‌ها, بزرگ‌ترین)
Digits DigitConverter toPersian / toEnglish / toArabic + HTML-aware convertContent()

Install

Requires PHP 8.1+. No runtime extensions beyond mbstring.

Quick examples

Validation

Three entry points per validator (same pattern as BackedEnum), ordered by how most apps use them:

isValid() vs isStrictlyValid(). validate() can return true with a non-fatal warning when the input parses cleanly but an optional lookup fails (unknown card BIN, unknown mobile-operator prefix). isValid() does not reject these. For strict acceptance — form submissions, payment flows — use from() / tryFrom() (which reject warning-bearing results) or call isStrictlyValid() explicitly. The warning path is documented per validator under docs/en/.

Formatting

Money

Text

Digits

Plate numbers

Display formatters

Fixtures and extraction

Persian collation and half-space fixing

Further reading

Longer-form docs live under API stability policy, async-runtime notes, and framework integration recipes.

Related packages

Abzar deliberately stays narrow. Two companion packages cover adjacent ground:

See docs/en/related.md for a longer comparison.

Versus other Persian PHP libraries

abzar persian-tools (JS) nikapps/iran-validator
Language PHP 8.1+ JS/TS PHP 7.4+
Zero runtime deps Yes Yes
Typed result object (isValid/errors/details) Yes Partial No (bool only)
JsonSerializable result Yes n/a No
Structured error codes Yes No No
Bank card / IBAN / phone / national-ID / legal-ID Yes Yes Subset
Number-to-words / time-ago / ordinals Yes Yes No
Slug / char normalize / digit convert Yes Partial No
WordPress integration Via eramhq/persian-kit No No

Framework bridges

Abzar stays framework-agnostic. Integration recipes for Laravel FormRequest, Symfony Validator, Symfony Console, and WordPress live under docs/en/recipes/. Each is a few dozen lines — paste into your project and tweak.

Stability

Abzar is in 0.x. Breaking changes may happen before 1.0; pin with ^0.5@beta until the API stabilizes. The API stability policy spells out which parts of the surface are protected — ErrorCode values are pinned as stable API as of 0.3.

License

MIT. See persian-tools project.


All versions of abzar with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eram/abzar contains the following files

Loading the files please wait ...