spatie/enum
Obsolete: PHP 8.1+ has native enums (recommended). Spatie Enum provides strongly typed, object-based enums for older PHP versions, enabling IDE-friendly static analysis and refactoring. Define enums via @method annotations and call StatusEnum::draft().
Architecture fit: The package is fundamentally obsolete for modern PHP applications due to PHP 8.1+ native enum support. It adds unnecessary complexity for new projects and creates redundancy where built-in language features already provide superior functionality. For legacy PHP <8.1 projects, it serves as a stopgap but upgrading PHP is always preferable.
Integration feasibility: Very low. Native enums eliminate all use cases for this package, making integration redundant. Attempting to use it alongside PHP 8.1+ native enums would cause conflicts and violate type safety principles. The package's dependency on method-based static calls conflicts with native enum syntax.
Technical risk: High. The maintainers explicitly mark it as obsolete, meaning no security patches, bug fixes, or compatibility updates will be provided. Projects using it face unpatchable vulnerabilities and potential breakage with future PHP versions. The package's "read-only property" implementation could introduce subtle bugs when interacting with PHP's native enum type system.
Key questions: 1) What PHP version is the project targeting? If <8.1, prioritize upgrading PHP instead of adopting this package. 2) Are there any legacy constraints preventing PHP upgrade? If yes, this package should be a temporary measure with a clear migration plan to native enums. 3) Why would a new project use a deprecated solution when native enums offer better performance, type safety, and IDE support?
Stack fit: Only relevant for PHP <8.1 environments (which are increasingly unsupported and insecure). For any PHP 8.1+ project, native enums are the only appropriate solution. The package has no value in modern Laravel stacks (Laravel 9+ requires PHP 8.0+ and Laravel 10+ requires PHP 8.1+).
Migration path: For existing projects using this package: 1) Upgrade PHP to 8.1+, 2) Convert all Spatie\Enum\Enum classes to native enum declarations, 3) Replace StatusEnum::draft() with StatusEnum::Draft syntax, 4) Update database serialization to use name or value properties of native enums. The spatie/laravel-enum wrapper package should be removed entirely.
Compatibility: The package is fundamentally incompatible with PHP 8.1+ native enums. Using both would create type system conflicts (e.g., StatusEnum::draft() instanceof \Spatie\Enum\Enum vs StatusEnum::Draft instanceof StatusEnum). Laravel's native enum casting (introduced in Laravel 9) requires PHP native enums.
Sequencing: 1) Upgrade PHP to 8.1+ as top priority, 2) Remove all dependencies on this package during upgrade process, 3) Implement native enums using Laravel's built-in casting and validation features. Never integrate this package into new projects – it creates immediate technical debt.
Maintenance: High burden. The package has no active development (last release April 2022), no security updates, and no roadmap. Any bugs or compatibility issues will require custom fixes. Spatie has explicitly redirected users to native enums, meaning community support is minimal.
Support: Effectively nonexistent. Spatie's documentation states "this package is now considered obsolete" and provides no migration guidance beyond "use native enums". The GitHub issues page shows declining activity, with new questions often answered by directing users to PHP 8.1+ features.
Scaling: No inherent scaling limitations, but technical debt accumulates rapidly. Database serialization patterns (e.g., using value property) become harder to maintain as the code
How can I help you explore Laravel packages today?