Oihana PHP Standards

Oihana PHP Standards

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:

πŸ”— 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

NamespaceCoverage
org\isoISO 8601 (date/time/duration/interval/recurrence + format), ISO 3166-1, ISO 639-1, ISO 4217, ISO 15924
org\ietfBCP 47 / RFC 5646 locale tags
org\unece\uncefactUN/CEFACT units of measure (Rec. 20) and package types (Rec. 21)
org\unstatsUN M49 country/area codes
org\commonCross-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

πŸ‘€ About the author

Table of Contents

Namespaces

org

Search results