Weave 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
States Bundle

States Bundle Laravel Package

teknoo/states-bundle

Teknoo States Bundle is a Symfony bundle for defining and managing object states and transitions. It provides configurable state machines, transition rules, and workflow integration for PHP applications that need clear lifecycle handling.

View on GitHub
Deep Wiki
Context7

Symfony bunde to create PHP classes following the State pattern in PHP. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements and thus improve maintainability. (Build on the Teknoo Software States library)

Frequently asked questions about States Bundle
Is teknoo/states-bundle compatible with Laravel?
No. It is a Symfony bundle that ships a Bundle subclass wired for Symfony's HttpKernel, a DI compiler pass and a configuration tree, and Laravel has no equivalent bundle, container extension or kernel hook. The TPM assessment rates Laravel integration as low as packaged and says the bundle half cannot be reused without reimplementation. Treat any Laravel use as a pattern reference, not a drop-in dependency.
Can I install teknoo/states-bundle with Composer in a Laravel app?
You technically can add it, but dependency resolution is a practical blocker: the bundle's constraints are pinned to Symfony generations, so a modern Laravel composer.json will either fail resolution or pull the full Symfony framework stack in alongside Illuminate. That duplicates HTTP kernel and container concepts and creates a large review surface. The assessment recommends not installing this bundle.
What is the successor to teknoo/states-bundle?
The repository is archived and explicitly deprecated by the author, who points consumers at teknoo/states 3.1+. The framework-agnostic library implements the State pattern with attribute-driven configuration and is the realistic evaluation unit. The spike question is whether teknoo/states 3.1+ is actively released or also dormant, since a pointer to a dead successor is not a migration.
What Laravel alternatives exist for state machines?
Laravel already has idiomatic options: PHP 8.1 backed enums with transition methods, the Illuminate Pipeline component, or an actively maintained package such as Spatie's model-states. Those follow framework conventions, get community patches and need no explanation to a new hire. The assessment's Route B is to adopt the pattern, not the package.
Does teknoo/states-bundle support PHP 8.1 enums and typed properties?
The supplied context does not state a PHP version range or enum support, and the assessment lists this as an open spike question. You must confirm what PHP range it supports and whether the generator emits typed properties and 8.1 enums or only pre-8.0 idioms. Do not assume modern PHP output before checking the library.
How does the code generator affect CI and static analysis?
Generated classes must pass your PHPStan/Psalm baseline and coding standard, or every regeneration trips CI. The assessment calls this the codegen tax. Also establish whether the generator runs at build time with committed artifacts, which is survivable, or at runtime via reflection and cache, which is not.
Is teknoo/states-bundle safe to use in production?
High risk. The repository is archived, so there is no security response path and an archived project cannot ship a CVE fix; anything you depend on there you effectively own. Adoption is effectively zero, with no bug reports, downstream compatibility testing or community corpus, so every issue becomes your own research project. Opportunity without maintenance is a liability.
How would I integrate teknoo/states into Laravel if I chose Route A?
Composer require teknoo/states, then write a small Laravel service provider to replace the Symfony compiler pass for state-class discovery. Everything Symfony-specific is reimplemented by you, including discovery and hydration that Symfony provided for free. This is the assessment's Route A and only makes sense after confirming the successor is maintained.
Is a state machine package worth it versus hand-written code?
The assessment suggests asking how much of the value is the generator versus the pattern guidance, and whether three hand-written interfaces plus an enum-backed transition table deliver 80 percent of the benefit. The State pattern is small and well understood; codegen buys consistency across many similar state machines, not correctness on the first one. Start with native enums or Spatie's package unless you have many machines.
What does teknoo/states-bundle actually provide?
It is a Symfony bundle for declarative states and transitions with guard conditions, object-oriented state pattern classes instead of switch statements, service container integration, and hooks for entry/exit actions and transition callbacks. It targets workflows, orders and document lifecycles in Symfony PHP applications. None of that changes the fact that the bundle layer is Symfony-specific and the repository is deprecated.
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.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core