Download the PHP package tkaratug/powered-enum without Composer
On this page you can find all versions of the php package tkaratug/powered-enum. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download tkaratug/powered-enum
More information about tkaratug/powered-enum
Files in tkaratug/powered-enum
Download tkaratug/powered-enum
More information about tkaratug/powered-enum
Files in tkaratug/powered-enum
Vendor tkaratug
Package powered-enum
Short Description Some cool add-ons to PHP native enums.
License MIT
Homepage https://github.com/tkaratug/powered-enum
Package powered-enum
Short Description Some cool add-ons to PHP native enums.
License MIT
Homepage https://github.com/tkaratug/powered-enum
Please rate this library. Is it a good library?
Informations about the package powered-enum
Powered Enum
This package offers a trait that contains some cool features for native PHP enums.
Requirements
- PHP
8.1
or higher.
Installation
Declaration
All you need to do is use the PoweredEnum
trait in your native PHP enums.
Jump To
- Methods
- is(), isNot()
- Static Methods
- hasName()
- hasValue()
- getNames()
- getValues()
- toArray()
- getNamesExcept()
- getValuesExcept()
- toArrayExcept()
- getRandomName()
- getRandomValue()
- getRandomCase()
Methods
is(), isNot()
- You can check the equality of a case against any name by passing it to the
is()
andisNot()
methods.
Static Methods
hasName()
- You can check whether an enum has a case by given name via the
hasName()
method.
hasValue()
- You can check whether an enum has a case by given value via the
hasValue()
method.
getNames()
- You can get enum case names as an array by using the
getNames()
method.
getValues()
- You can get enum case values as an array by using the
getValues()
method.
toArray()
- You can get a combined array of the enum cases as
value => name
by using thetoArray()
method.
getNamesExcept()
- You can get names of enum cases as an array except for given ones by using the
getNamesExcept()
method.
getValuesExcept()
- You can get values of enum cases as an array except for given ones by using the
getValuesExcept()
method.
toArrayExcept()
- You can get a combined array of the enum cases as
value => name
except for given ones by using thetoArrayExcept()
method.
getRandomName()
- You can get a random name of the enum cases by using the
getRandomName()
method.
getRandomValue()
- You can get a random value of the enum cases by using the
getRandomValue()
method.
getRandomCase()
- You can get a random case of the enum by using the
getRandomCase()
method.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.
Credits
- Turan Karatuğ
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of powered-enum with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
The package tkaratug/powered-enum contains the following files
Loading the files please wait ....