Download the PHP package skywalker-labs/enum without Composer
On this page you can find all versions of the php package skywalker-labs/enum. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download skywalker-labs/enum
More information about skywalker-labs/enum
Files in skywalker-labs/enum
Package enum
Short Description A robust and type-safe Enum implementation for PHP, featuring singleton-based constants, mapping capabilities, and extensive compatibility from PHP 7.0 to 9.0.
License MIT
Informations about the package enum
Skywalker Enum
A robust, type-safe, and singleton-based Enum implementation for PHP.
This library provides a clean way to implement enums in PHP, ensuring that each enum value is a unique singleton instance. It works across PHP versions from 7.0 to 9.0+.
Installation
Install the package via Composer:
Basic Usage
To create an enum, extend Skywalker\Enum\AbstractEnum and define your constants as protected const.
Pro Features
1. Flexible JSON Serialization
Control how your enums appear in API responses.
2. Native PHP Compatibility
Use aliases that match PHP 8.1+ native enums for a smoother transition.
3. Randomization
Perfect for seeders and unit tests.
4. String Helpers
5. Collection Power-Ups (EnumSet)
Functional methods for modern collections.
Ultimate Edition Features
1. Navigational Helpers
Sequence through your enums easily.
2. Set Theory (EnumSet)
Perform mathematical set operations.
3. Tolerant Lookups
Handle user input with case-insensitivity.
Advanced Features
Collection & UI Helpers
Type-Safe Comparisons
Bitmask Support
Efficiently store multiple enum values in a single integer.
License
This project is licensed under the MIT License. See the LICENSE file for details.