Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Enum Laravel Package

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().

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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?

Integration Approach

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.

Operational Impact

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

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport