Download the PHP package dive-be/php-enum-utils without Composer
On this page you can find all versions of the php package dive-be/php-enum-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dive-be/php-enum-utils
More information about dive-be/php-enum-utils
Files in dive-be/php-enum-utils
Package php-enum-utils
Short Description Those utilities you always need when dealing with native enumerations.
License MIT
Homepage https://github.com/dive-be/php-enum-utils
Informations about the package php-enum-utils
🛠 Native enum utilities you always need
This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.
- Arrayable
- Assertable
- Comparable
- NameListable
- ValueListable
- WithUtilities
Installation
You can install the package via composer:
Usage
Assume the following string
backed enum:
Arrayable (backed enums only)
Allows you to retrieve a key-value pair of names and values:
Assertable
This relies on the enum names being in PascalCase, which follows Larry Garfield's RFC.
Allows you to make assertions on enum instances using predicate functions:
Comparable
Allows you to compare enums. Mostly useful when providing backed values:
NameListable
Allows you to retrieve a list of the enum names:
ValueListable (backed enums only)
Allows you to retrieve a list of the enum values:
WithUtilities (backed enums only)
Aggregator trait for all of the aforementioned utilities.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Muhammed Sari
- All Contributors
License
The MIT License (MIT). Please see License File for more information.