oihana/php-standards

The Oihana PHP Standards library

Maintainers

Package info

github.com/BcommeBois/oihana-php-standards

Homepage

pkg:composer/oihana/php-standards

Statistics

Installs: 82

Dependents: 6

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2025-08-13 09:29 UTC

This package is auto-updated.

Last update: 2026-05-14 18:30:19 UTC


README

Oihana PHP System

Oihana PHP – Standards is a library of constants, value-objects and helpers built on top of international standards (ISO, IETF, UN/CEFACT, UN M49).

It is designed for strong typing, validation and easy lookups in your PHP 8.4+ applications.

Latest Version Total Downloads License

πŸ“š Documentation

Full documentation is available in two languages:

Quick links: Getting started Β· ConstantsTrait Β· Value-objects Β· Helpers convention

πŸ“¦ Installation

Requires PHP 8.4+ (uses property hooks).

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

Many more examples in the documentation.

πŸ“œ License

MPL 2.0 β€” Mozilla Public License Version 2.0

πŸ‘€ Author