Oihana PHP Enums

Oihana PHP Enums

Latest Version Total Downloads License

A collection of strongly-typed constant enumerations for PHP β€” over 1,600 constants across 73 classes (general, HTTP, mail, JWT/JOSE, OAuth 2.0/OIDC), all sharing one reflection API through ConstantsTrait. No magic strings.

πŸ“š Documentation

Narrative user guides (FR + EN), with examples and the full catalogue per namespace:

You are currently browsing the auto-generated API reference (phpDocumentor).

πŸ“¦ Installation

This library requires PHP 8.4+ and is installed via Composer:

composer require oihana/php-enums

✨ Features

  • πŸ“¦ 73 enumerations / 1,600+ constants across general, HTTP, mail/SMTP, JWT/JOSE and OAuth 2.0/OIDC domains.
  • πŸ” One shared reflection API via ConstantsTrait β€” enums(), includes(), getConstant(), validate() β€” identical on every class.
  • 🧩 Composable per-category traits for HttpHeader and MailHeader β€” use only what you need.
  • βš™οΈ Domain helpers where they help (status descriptions, SMTP security, mail priority conversions, postal-code validation, …).
  • πŸ›‘οΈ No magic strings β€” typo-safe, refactor-friendly, IDE-autocompleted.

βœ… Tests & coverage

Run the unit-test suite (PHPUnit, strict mode):

composer test

Run a single test case:

./vendor/bin/phpunit --filter HttpStatusCodeTest

Measure coverage (requires Xdebug or PCOV):

composer coverage
composer coverage:md

The suite covers 100% of lines (323/323). See the testing guide: English Β· FranΓ§ais.

🧾 License

This project is licensed under the Mozilla Public License 2.0 (MPL-2.0).

πŸ‘€ About the Author

πŸ”— Related packages

πŸ”— Project on GitHub

View the full source code and contribute on GitHub: github.com/BcommeBois/oihana-php-enums.

Search results