Download the PHP package oihana/php-standards without Composer
On this page you can find all versions of the php package oihana/php-standards. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package php-standards
Oihana PHP – Standards
Oihana PHP – Standards is a library of constants, enumerations, and helpers based on major international standards (ISO, UN, UN/CEFACT, etc.).
It is designed for strong typing, validation, and easy lookups in your PHP applications.
📑 Table of Contents
- Installation
- Features
- Namespace Overview
- Available Enumerations
- Core Helper Methods
- Usage Examples
- License
- Author
📦 Installation
Requires PHP 8.4+
Install via Composer:
✨ Features
- Ready-to-use enumerations for currencies, languages, scripts, country codes, measurement units, package types, and more.
- Built-in helpers for validation, lookups, and cross-conversions (e.g., code ↔ name ↔ symbol).
- Clear namespace organization for quick navigation and maintainability.
🗂 Namespace Overview
Namespace | Description |
---|---|
org\iso |
ISO-related enumerations (currencies, languages, scripts). |
org\unstats |
United Nations M49 country and area codes (alpha-3). |
org\unece\uncefact |
UN/CEFACT recommendations (units of measure, package types) with cross lookups. |
📚 Available Enumerations
Class | Description | Example |
---|---|---|
org\iso\ISO4217 |
ISO 4217 currency codes (alpha-3) | ISO4217::USD // 'USD' |
org\iso\ISO6391 |
ISO 639-1 language codes (alpha-2) | ISO6391::EN // 'en' |
org\iso\ISO15924 |
ISO 15924 script codes | ISO15924::LATN // 'Latn' |
org\unstats\UNM49 |
UN M49 country/area codes (alpha-3) | UNM49::FRA // 'FRA' |
org\unece\uncefact\MeasureCode |
UN/CEFACT Rec. 20 unit codes | MeasureCode::KILOGRAM // 'KGM' |
org\unece\uncefact\MeasureName |
UN/CEFACT unit names | MeasureName::KILOGRAM // 'Kilogram' |
org\unece\uncefact\MeasureSymbol |
UN/CEFACT unit symbols | MeasureSymbol::KILOGRAM // 'kg' |
org\unece\uncefact\PackageCode |
UN/CEFACT Rec. 21 package type codes | PackageCode::BOX // 'BX' |
org\unece\uncefact\PackageName |
UN/CEFACT package type names | PackageName::BOX // 'Box' |
🔧 Core Helper Methods (ConstantsTrait
)
All constant classes use oihana\reflections\traits\ConstantsTrait
, which provides:
Method | Description |
---|---|
getAll() |
Returns a [name => value] map of constants. |
enums(int $flags = SORT_STRING) |
Returns unique sorted values. |
includes(mixed $value, bool $strict = false, ?string $separator = null) |
Checks if a value exists. |
get(mixed $value, mixed $default = null) |
Returns the value if valid, otherwise $default . |
validate(mixed $value, bool $strict = true, ?string $separator = null) |
Validates or throws an exception. |
getConstant(string $value, array|string|null $separator = null) |
Returns constant name(s) for a given value. |
resetCaches() |
Clears internal caches. |
💡 Usage Examples
Basic Enum Access
Validation & Listing
UN/CEFACT Unit Cross-Lookups
UN/CEFACT Package Conversion
UN M49 Country Codes
📜 License
MPL 2.0 — Mozilla Public License Version 2.0
👤 Author
- Marc ALCARAZ (aka eKameleon)
- 📧 [email protected]
- 🌐 http://www.ooop.fr
All versions of php-standards with dependencies
PHP Build Version
Package Version
The package oihana/php-standards contains the following files
Loading the files please wait ....