Download the PHP package palabs/php-enum without Composer
On this page you can find all versions of the php package palabs/php-enum. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download palabs/php-enum
More information about palabs/php-enum
Files in palabs/php-enum
Download palabs/php-enum
More information about palabs/php-enum
Files in palabs/php-enum
Vendor palabs
Package php-enum
Short Description Java-like PHP Enum implementation for php 7.4+
License MIT
Homepage http://github.com/PaLabs/php-enum
Package php-enum
Short Description Java-like PHP Enum implementation for php 7.4+
License MIT
Homepage http://github.com/PaLabs/php-enum
Please rate this library. Is it a good library?
Informations about the package php-enum
PHP Enum implementation (Java-like) for php7.4+
Benefits
- Type-hint:
function someAction(Action $action) {
- No magick methods or phpdoc comments, only raw enum values
- List of all the possible values
- Own fields or methods in enums
Installation
Create your first enum
That's all!
Examples
Custom fields in enum
Methods
name()
Returns name of the current enum instance (e.g. 'VIEW' for Action::$VIEW)ordinal()
Returns ordinal number of enum instance in all enum instance start with 0. E.g. 0 for Action::$VIEW, 1 for Action::$EDITequals(Enum $other)
- Tests whether enum instances are equal or not
Static methods
values()
Returns all enum instancesvalueOf(string $name)
Return enum instance for given name or throwing exception if no enum instance foundinit()
- Initialize enum (filling enum instances). Need to be called after enum declaration
All versions of php-enum with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.4
The package palabs/php-enum contains the following files
Loading the files please wait ....