bidzm/eloquent-state-machine
A Laravel package that adds state machine behavior to Eloquent models. Define states and allowed transitions, guard or authorize changes, and persist the current state automatically. Keeps model lifecycle logic clean and predictable, with hooks and events for reacting to transitions.
awaiting_review"), which is a product decision about what to measure, not just an engineering one.spatie/laravel-model-states or a full workflow engine is more surface area than the feature justifies, a small in-house state machine is the better trade — this repo shows roughly what that costs.composer.json against your stack before anything else; a package this small and this inactive is unlikely to have kept pace with recent Laravel majors. Budget a spike to confirm it installs and the tests pass on your versions.To executives: This is a low-cost evaluation, not a platform commitment. It gives us a concrete, MIT-licensed example of how to encode business rules like "an order can only be refunded after it ships" directly in the codebase, so those rules are enforced in one place instead of scattered across screens. The package itself is small and unmaintained — one star, no downstream users — so the recommendation is to use it as a design reference and internalize the pattern, not to take on a long-term dependency. Expected cost is a short engineering spike; the payoff is fewer order/onboarding inconsistency bugs and clearer, earlier conversations about what our workflows actually are.
To engineering: Read it as a pattern, not a library. It models state as an Eloquent attribute with guarded transition methods — the minimum viable state machine. Confirm PHP/Laravel compatibility, then fork the approach into our own app/ namespace with tests and an explicit transition table rather than adding it to composer.json. If the domain turns out to need transition auditing, role-aware guards, or side effects on transition, we should stop and adopt a maintained package instead of growing this code ourselves. Decision requested: approve a one-to-two day spike to prototype our primary lifecycle (e.g., orders) against this pattern and report back on whether it holds.
How can I help you explore Laravel packages today?