Download the PHP package fast-forward/enum without Composer
On this page you can find all versions of the php package fast-forward/enum. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fast-forward/enum
More information about fast-forward/enum
Files in fast-forward/enum
Package enum
Short Description Ergonomic utilities for PHP enums, including names, values, lookups, and option maps.
License MIT
Homepage https://github.com/php-fast-forward/enum
Informations about the package enum
Fast Forward Enum
Ergonomic utilities and reusable catalogs for PHP enums, including names, values, lookups, maps, sorting helpers, and enum-driven workflows.
โจ Features
- ๐งฉ Traits for
values(),names(), options, maps, lookups, and enum comparisons - ๐งญ
Helper\EnumHelperfor generic operations overUnitEnumandBackedEnum - ๐ Reversible sort-oriented enums such as
SortDirection,NullsPosition, andComparisonResult - ๐ Reusable catalogs grouped by domain, including
Calendar,Logger,Runtime, andDateTime - ๐ฆ Enum-based workflow transitions through
StateMachine\HasTransitions - ๐ท Optional
LabeledEnumInterfaceand readable descriptions without framework lock-in - ๐งผ Small public API with explicit namespaces and no
Contractsbucket
๐ฆ Installation
Requirements:
- PHP
^8.3
New to the package? Start with the Quickstart, then use the Usage guide when you want more complete examples.
๐ ๏ธ Usage
Basic enum ergonomics:
Labels and label maps:
Enum-driven workflows:
Packaged enum catalogs:
๐งฐ API Summary
| API | Description |
|---|---|
Helper\EnumHelper |
Static helpers for cases, names, values, labels, maps, and lookups |
Trait\HasValues |
Adds values() to backed enums |
Trait\HasNames |
Adds names() to any enum |
Trait\HasNameLookup |
Adds fromName(), tryFromName(), and hasName() |
Trait\HasOptions |
Builds option arrays keyed by case name |
Trait\HasNameMap / Trait\HasValueMap |
Builds lookup maps for names and backed values |
Trait\Comparable |
Adds is(), isNot(), in(), and notIn() |
Trait\HasDescription |
Generates readable descriptions from case names |
Trait\HasLabel |
Provides a technical fallback label() implementation |
LabeledEnumInterface |
Contract for enums that expose presentation labels |
DescribedEnumInterface |
Contract for enums that expose human-readable descriptions |
ReversibleInterface |
Common contract for enums exposing reverse() |
StateMachine\HasTransitions |
Adds transition, terminal, and initial-state behavior to workflow enums |
StateMachine\InvalidTransitionException |
Exception thrown by invalid workflow transitions |
๐ Integration
fast-forward/enum is framework-agnostic and works well in:
- form and UI option generation
- DTO, request, and serializer layers
- validation and name/value normalization
- internal workflow modeling with enum transitions
- logging, sorting, date/time, and runtime catalogs shared across Fast Forward packages
It does not require a container, framework bridge, or reflection-heavy metadata system.
๐ Directory Structure Example
โ๏ธ Advanced & Customization
- Implement
LabeledEnumInterfacewhen you need explicit presentation labels. - Use your own domain enums when semantics are business-specific rather than generic.
- Combine
Comparable, lookup traits, andHasTransitionsto build compact workflow models. - Prefer the packaged catalogs only when the semantics are stable and cross-project.
๐ ๏ธ Versioning & Breaking Changes
The current development line tracks 1.x-dev. There is no published breaking-change history yet for
this package.
โ FAQ
Q: Why does this package expose traits instead of one giant helper class?
Traits let enums opt into only the ergonomics they need while keeping the public surface explicit.
Q: Why is there no Contracts namespace?
Public interfaces stay in the root namespace so the package does not hide core API behind a generic
bucket.
Q: Is ComparisonResult a PHP polyfill?
No. It is a Fast Forward enum for comparator-style semantics, not a promise of native compatibility.
๐ก License
MIT ยฉ 2026 Felipe Sayรฃo Lobato Abreu
๐ค Contributing
Issues, pull requests, and documentation improvements are welcome.
- Read AGENTS.md for repository-specific guidance
- Run
composer dump-autoload - Run
./vendor/bin/dev-tools tests - Update the README and relevant docs when changing public API
๐ Links
- Repository
- Packagist
- Documentation site
- Sphinx docs source
- Wiki
- Issue tracker
- Coverage report
- Tests workflow
- MIT License
- RFC 2119
All versions of enum with dependencies
ext-mbstring Version *