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

Laravel State Machine Laravel Package

sebdesign/laravel-state-machine

A lightweight Laravel package for adding state machines to Eloquent models. Define states, transitions, and guards, then move records safely between states with validation, events, and clear exceptions. Integrates cleanly with Laravel and supports custom classes.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Workflow/state modeling for core domain objects — order lifecycles, subscription billing states, approval pipelines, onboarding flows, ticket statuses. A state machine package lets you encode legal transitions, guards, and side effects declaratively instead of scattering if ($status === ...) checks across controllers and models.
  • Build vs. buy for workflow engines — this is the "buy (a library)" option for teams that need deterministic transitions but not a full BPMN/workflow platform (Temporal, Camunda, etc.). Useful input when scoping a "do we build our own state handling?" spike.
  • Feature design reviews — when a spec says "statuses: draft, pending, approved, rejected," the PM can ask engineering whether transitions are modeled formally or ad hoc. This package is a concrete reference for that conversation.
  • Roadmap sequencing — Laravel 13.x compatibility in v3.4.7 means the library tracks the framework's upgrade cadence. That removes one dependency risk from your Laravel 12→13 upgrade planning.
  • Auditability and compliance features — state machines make transitions explicit and loggable, which supports requirements for approval trails, "who changed this status," and preventing illegal jumps (e.g., a cancelled order moving to shipped).

When to Consider This Package

Adopt or pilot when:

  • You're on Laravel and have more than one object with a non-trivial lifecycle (3+ states and more than a couple of transition rules). At one simple status field, native Eloquent column + a handful of methods is fine.
  • You need legal-transition enforcement and want to fail loudly on illegal moves rather than rely on convention.
  • You want centralized, testable transition logic — you can unit-test the graph without booting the whole request stack.
  • Framework alignment matters: v3.4.7 adds Laravel 13.x compatibility, so the package is being actively maintained against current Laravel releases rather than abandoned.

Look elsewhere or hold when:

  • Your workflow is long-running, involves human task queues, timers, retries, or distributed workers — you want a durable workflow orchestrator (Temporal, Laravel queues + a saga pattern, or a dedicated BPMN tool), not an in-process state machine.
  • Very high transition volume and you need horizontal coordination across services — in-app state machines don't solve distributed consistency.
  • You have zero existing state-machine pain — introducing a DSL where plain code already works adds a learning cost with no payoff.
  • You need a large out-of-the-box admin UI / visual editor for flows; this is a code-level library, not a workflow-designer product.

How to Pitch It (Stakeholders)

To executives: This is a small, mature open-source library that formalizes how our Laravel applications move business objects through states — orders, accounts, approvals. The direct benefit is fewer "impossible status" bugs and a clean audit trail, which matters for compliance-adjacent features and support escalations. The new release simply confirms it stays current with Laravel 13, so adopting it does not add upgrade risk. Cost is near zero (MIT-style open source); the real investment is a few engineering days to model flows properly.

To engineering: Version 3.4.7 is a maintenance release — Laravel 13.x compatibility only, no breaking changes, no new APIs, no deprecations. Safe to upgrade on that basis. Practically, the package gives us declarative transition definitions with guards, so transition rules live in one testable place instead of being re-implemented per controller. If we adopt, I'd want a spike on one high-traffic entity (e.g., orders) to validate the guards/events map cleanly onto our existing event and notification hooks before we commit broadly.

Recommendation: Low-risk, low-cost dependency. Worth a scoped pilot on a single stateful entity; not worth adopting speculatively where plain code already works.

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