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

Laravel State Machine Laravel Package

webrek/laravel-state-machine

View on GitHub
Deep Wiki
Context7
v1.1.0

Added

  • Transition effects via Transition::using($closure) that run inside the same database transaction as the state change and history — if the effect throws, the whole transition rolls back (and in-memory state is reverted).
  • toMermaid() on the definition and handler, plus a state-machine:diagram artisan command, to render the machine as a Mermaid stateDiagram-v2.

Changed

  • apply() now wraps the state change, effect and history in one transaction.
v1.0.0

First stable release.

Declarative state machines for Eloquent models:

  • StateMachine definitions (states, transitions, initial state), validated on use.
  • Transition builder with multiple source states and optional guards.
  • HasStateMachines trait: seeds the initial state and exposes can / allowed / apply / history.
  • StateTransitioning and StateTransitioned events.
  • Optional transition history with a publishable migration.

Requires PHP 8.2+ and Laravel 12.

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.
codraw/graphviz
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata