Download the PHP package amine-zhioua/degache-php without Composer
On this page you can find all versions of the php package amine-zhioua/degache-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download amine-zhioua/degache-php
More information about amine-zhioua/degache-php
Files in amine-zhioua/degache-php
Package degache-php
Short Description A framework-agnostic PHP library of Tunisian utilities: phone number, CIN, RIB, car plate, postal code, and tax ID validation, plus currency and date formatting for the Tunisian locale.
License MIT
Informations about the package degache-php
degache-php
A framework-agnostic PHP library of Tunisian utilities — validators for phone numbers, CIN, RIB, car plates, postal codes, and tax IDs, plus locale-aware currency and date formatting.
Ported from degachejs (the original JavaScript/TypeScript library), with the API redesigned to feel native to PHP rather than a direct translation.
Works with Laravel, Symfony, CodeIgniter, or plain PHP — the core package has no framework dependencies.
Requirements
- PHP 8.2+
ext-intl(used for currency and date formatting)
Installation
Quick start
Every feature is available two ways:
- The
Degachefacade — one class, static methods, good for quick scripts or simple apps. - Individual Validator/Formatter classes — better for dependency injection, testing, or when you only need one feature and want a smaller autoload footprint.
Both call the same underlying code — the facade just delegates.
Features
Phone number
Validates Tunisian mobile numbers and identifies the carrier (Ooredoo, Orange, Tunisie Telecom).
CIN (Carte d'Identité Nationale)
RIB / Banks
Validates a 20-digit Tunisian bank RIB and identifies the issuing bank.
Note: RIB validation checks structural format and that the bank code exists, but does not yet verify the RIB key checksum digit.
Car plate
Validates standard (123 تونس 4567) and special/RS (RS 123 تونس) Tunisian plates.
Postal code
Validates against the real map of ~680 Tunisian postal codes across all 24 governorates.
Tax ID (Matricule Fiscal)
Currency
Formats amounts as Tunisian Dinar using the ar-TN locale (via ext-intl).
Date
Formats dates using the ar-TN locale, with Maghrebi month names (e.g. جانفي, not يناير).
Design notes
- No options objects. Where the original JS library used an options bag (
{ strict: true }), this port uses named arguments instead (strict: true), which is more idiomatic in modern PHP. - DTOs over arrays. Structured results (
CarrierInfo,BankInfo,CarPlateInfo) arereadonlyclasses, not associative arrays — you get autocomplete and type safety. - One intentional behavior difference:
formatPhoneNumberdiverges from the original JS library, which has a bug where numbers already containing the+216prefix format incorrectly. This is fixed here. See [degachejs issue #TBD] if you're curious about the original bug.
Testing
Contributing
Issues and PRs welcome.
License
MIT
All versions of degache-php with dependencies
ext-intl Version *