PHPackages                             bakame/aide-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. bakame/aide-enums

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

bakame/aide-enums
=================

Collection of traits to ease Enum manipulation in PHP

0.1.0(2y ago)0693—0%11MITPHPPHP ^8.1

Since Dec 9Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/bakame-php/aide-enum)[ Packagist](https://packagist.org/packages/bakame/aide-enums)[ GitHub Sponsors](https://github.com/sponsors/nyamsprod)[ RSS](/packages/bakame-aide-enums/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Aide for Enums
==============

[](#aide-for-enums)

A collection of traits and classes to improve handling PHP's Enum.

Caution

Sub-split of Aide for Enum helpers.
⚠️ this is a sub-split, for pull requests and issues, visit:

Installation
------------

[](#installation)

### Composer

[](#composer)

```
composer require bakame-php/aide-enums

```

### System Requirements

[](#system-requirements)

You need:

- **PHP &gt;= 8.1** but the latest stable version of PHP is recommended

Usage
-----

[](#usage)

### Traits

[](#traits)

#### Factory

[](#factory)

Enable creating Pure or Backed Enum based on their name. The trait adds two (2) new static methods, `tryFromName` and `fromName` and re-introduce the `tryFrom` and `from` method on pure Enums. Once added to your Enum you can do the following:

```
