oihana-php-standards
A library of constants, value-objects and helpers built on top of international standards (ISO, IETF, UN/CEFACT, UN M49). Designed for strong typing, validation and easy lookups in your PHP 8.4+ applications.
π Documentation
Full API documentation is published at:
https://bcommebois.github.io/oihana-php-standards
Guides and standards references are available in two languages:
- π¬π§ English documentation
- π«π· Documentation franΓ§aise
π Project on GitHub
View the full source code and contribute on GitHub:
https://github.com/BcommeBois/oihana-php-standards
π¦ Installation
Requires PHP 8.4+ (uses property hooks). Install via Composer:
composer require oihana/php-standards
π What's inside
| Namespace | Coverage |
|---|---|
org\iso | ISO 8601 (date/time/duration/interval/recurrence + format), ISO 3166-1, ISO 639-1, ISO 4217, ISO 15924 |
org\ietf | BCP 47 / RFC 5646 locale tags |
org\unece\uncefact | UN/CEFACT units of measure (Rec. 20) and package types (Rec. 21) |
org\unstats | UN M49 country/area codes |
org\common | Cross-standard format catalogs (date, number) |
π‘ At a glance
use org\iso\ISO4217;
use org\iso\Iso8601DateTime;
use org\ietf\Locale;
// Constants with built-in validation/lookup
ISO4217::EUR; // "EUR"
ISO4217::includes('XYZ'); // false
// ISO 8601 value-objects with property hooks
$dt = new Iso8601DateTime('2026-05-14T08:15:30+02:00');
$dt->datePart->year; // 2026
$dt->timePart->hours; // 8
// BCP 47 locales with cross-validation against ISO
new Locale('zh-Hant-TW', strict: true); // OK
new Locale('zz-ZZ', strict: true); // throws
β Running Unit Tests
Run all unit tests:
composer test
ποΈ Changelog
See CHANGELOG.md for notable changes.
π License
This project is licensed under the Mozilla Public License 2.0 (MPL-2.0).
π Related packages
oihana/php-coreβ core helpers and utilities used by this library: https://github.com/BcommeBois/oihana-php-coreoihana/php-reflectβ reflection and hydration utilities: https://github.com/BcommeBois/oihana-php-reflect
π€ About the author
- Author: Marc ALCARAZ (aka eKameleon)
- Website: www.ooop.fr
- Email: marc@ooop.fr