PHPackages                             oihana/php-enums - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. oihana/php-enums

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

oihana/php-enums
================

A collection of strongly-typed constant enumerations for PHP

1.0.0(9mo ago)0892MPL-2.0PHPPHP &gt;=8.4

Since Aug 13Pushed 3mo agoCompare

[ Source](https://github.com/BcommeBois/oihana-php-enums)[ Packagist](https://packagist.org/packages/oihana/php-enums)[ Docs](https://github.com/BcommeBois/oihana-php-reflect)[ RSS](/packages/oihana-php-enums/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (2)Used By (2)

Oihana PHP - Enums
==================

[](#oihana-php---enums)

[![Oihana Php Core](https://raw.githubusercontent.com/BcommeBois/oihana-php-enums/main/assets/images/oihana-php-enums-logo-inline-512x160.png)](https://raw.githubusercontent.com/BcommeBois/oihana-php-enums/main/assets/images/oihana-php-enums-logo-inline-512x160.png)

A collection of strongly-typed constant enumerations for PHP.

[![Latest Version](https://camo.githubusercontent.com/31694912939fd1c38dd6fb441ecba7bab15844d5722bbb097123b3e8a653349e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6968616e612f7068702d656e756d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-enums)
[![Total Downloads](https://camo.githubusercontent.com/caed1afe4d6d7ce0dea69351bb9a65e6e09e289088e8103bc2c6689eafeab0b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6968616e612f7068702d656e756d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-enums)
[![License](https://camo.githubusercontent.com/3d3c93f243c4b1ed7ebf21a5b0367b47c77677a457f0b0c4494ab81a5d30f6f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f6968616e612f7068702d656e756d732e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Oihana PHP Enums is a lightweight PHP library providing a set of well-structured enumerations implemented as constant classes. Each enumeration groups related symbolic values to replace hardcoded strings or numbers, improving readability, consistency, and typo safety across your codebase.

This package is designed to be framework-agnostic, fully compatible with PHP 8.4+, and works seamlessly with the ConstantsTrait for reflection and dynamic constant access.

📚 Documentation
---------------

[](#-documentation)

Full documentation: `https://bcommebois.github.io/oihana-php-enums`

📦 Installation
--------------

[](#-installation)

Requires [PHP 8.4+](https://php.net/releases/). Install via [Composer](https://getcomposer.org/):

```
composer require oihana/php-enums
```

✨ What you can do
-----------------

[](#-what-you-can-do)

- 📦 Multiple enumerations for different domains (e.g. Boolean, Char, IniOptions, and more).
- 🔍 Reflection-ready with ConstantsTrait for listing or validating values.
- 🛡️ Reduces “magic strings” and improves semantic clarity.
- 🧩 Easily reusable in any PHP application or framework.
- ⚡ No external dependencies except Oihana’s reflection utilities.

🚀 Quick Start
-------------

[](#-quick-start)

```
use oihana\enums\Boolean;
use oihana\enums\Char;
use oihana\enums\IniOptions;

// Boolean values as strings
$enabled = Boolean::TRUE; // 'true'

// Character constants
echo 'A' . Char::DOT . 'B'; // Outputs: A.B

// Ini options
ini_set(IniOptions::DISPLAY_ERRORS, '1');
```

✅ Running Unit Tests
--------------------

[](#-running-unit-tests)

To run all tests:

```
$ composer test
```

To run a specific test file:

```
$ composer test tests/oihana/enums/BooleanTest.php
```

🧾 License
---------

[](#-license)

This project is licensed under the [Mozilla Public License 2.0 (MPL-2.0)](https://www.mozilla.org/en-US/MPL/2.0/).

👤 About the author
------------------

[](#-about-the-author)

- Author : Marc ALCARAZ (aka eKameleon)
- Mail :
- Website :

🔗 Related packages
------------------

[](#-related-packages)

- `oihana/php-core` – core helpers and utilities used by this library: `https://github.com/BcommeBois/oihana-php-core`
- `oihana/php-reflect` – reflection and hydration utilities: `https://github.com/BcommeBois/oihana-php-reflect`

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance70

Regular maintenance activity

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

279d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d234506e51778dd3d1d61b6c2af6f294ff963651b4aa509b595d3d2a77b7d89b?d=identicon)[ooop](/maintainers/ooop)

---

Top Contributors

[![ekameleon](https://avatars.githubusercontent.com/u/749032?v=4)](https://github.com/ekameleon "ekameleon (27 commits)")

---

Tags

phpconstantsenums

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oihana-php-enums/health.svg)

```
[![Health](https://phpackages.com/badges/oihana-php-enums/health.svg)](https://phpackages.com/packages/oihana-php-enums)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
