Download the PHP package josezenem/php-enums-extended without Composer
On this page you can find all versions of the php package josezenem/php-enums-extended. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download josezenem/php-enums-extended
More information about josezenem/php-enums-extended
Files in josezenem/php-enums-extended
Package php-enums-extended
Short Description PHP 8.1 Enums Extended adds additional functionality when working with PHP 8.1+ Enums.
License MIT
Homepage https://github.com/josezenem/php-enums-extended
Informations about the package php-enums-extended
PHP 8.1 Enums Extended
PHP 8.1 Enums Extended, gives you the ability to use additional methods to work with PHP 8.1 Enums.
Installation
You can install the package via composer:
Usage
Available Methods
equals()
doesNotEqual()
isCall**()
Available Static Methods
options()
optionsFlipped()
names()
hasName()
values()
hasValue()
call**()
equals()
Pass one or multiple Enum cases, will return boolean if one matches.
doesNotEqual()
Pass one or multiple Enum cases, will return boolean if it does not match.
isCall**()
Returns boolean if the current value matches the desired case. Methods with underscores can be accessed via camel case, as well as their regular name.
options()
Will return an array of $val => $key.
optionsFlipped()
Will return an array of $key => $val.
names()
Will return an array of only names
hasName()
Pass variable and confirm if the name is valid for the Enum
values()
Will return an array of only values
hasValue()
Pass variable and confirm if the value is valid for the Enum
call**()
Will allow you to grab the value of a field by calling it statically.
Exception Handler
When using the magic methods, if the method calls do not exist, the system will throw
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Jose Jimenez
- All Contributors
- Special Thanks to Shocm for pushing me to make this, and answering my late replies.
License
The MIT License (MIT). Please see License File for more information.