iotron/laravel-state-machine
A Laravel package for building state machines around Eloquent models. Define states and allowed transitions, guard status changes, and keep workflow logic organized, explicit, and easy to test. Helps replace scattered status checks with a clear, maintainable transition map.
asantibanez/laravel-eloquent-state-machines means adopting this is a low-switching-cost decision — teams already on the original package can migrate without rewriting transition definitions, guarding that roadmap decision behind a Composer swap rather than an engineering project.DB::transaction() no longer create nested savepoints. This de-risks features where a transition and surrounding writes must commit or roll back atomically (e.g., "place order" = decrement inventory + transition state), and it directly reduces a class of production incidents that are painful to reproduce.Consider adopting when:
asantibanez/laravel-eloquent-state-machines; the drop-in compatibility makes this a low-risk trial.Look elsewhere when:
Caveats worth stating plainly: the version number (v1.0.1) signals an early-stage project despite a mature feature set inherited from the original. The package is a fork, which raises the question of long-term divergence from upstream and who absorbs maintenance if upstream stalls.
To executives: This is a small, low-cost library that makes our workflow logic explicit, auditable, and consistent — which shortens delivery on any feature involving approvals, order lifecycles, or subscription changes, and reduces the "states got out of sync" class of production bugs. The latest release adds Laravel 13 support (keeping our platform upgrade unblocked) and fixes a transaction-handling issue that could otherwise cause silent data inconsistencies in our highest-risk flows. It's a drop-in replacement for a package already common in the Laravel ecosystem, so the switching cost and lock-in are both low.
To engineering: v1.0.1 adds Laravel 13 to Composer requirements and CI (PHP 8.2 skipped on 13 per framework constraints), and changes StateMachine to check DB::transactionLevel() before opening a transaction — so transitions reuse an ambient transaction instead of nesting savepoints, which matters on stricter database configurations. Typing on State was tightened with proper Collection imports, and a new TransactionBoundaryTest plus expanded enum/history coverage backs the behavior. Supported: Laravel 11/12/13, PHP 8.2–8.4, MySQL/PostgreSQL/SQLite.
Recommended PM action: run a one-sprint spike on a single high-value workflow to validate the transition-history and transaction-boundary behavior against our actual database configuration before standardizing on it across domains. Track upstream activity and our fork-pin policy as an ongoing maintenance line item.
How can I help you explore Laravel packages today?