spatie/laravel-model-states
Add state and state machine behavior to Laravel Eloquent models. Represent each state as a class, automatically serialize to/from the database, and perform clean, explicit transitions with configurable rules—ideal for workflows like payments, orders, and approvals.
laravel-model-states can install the package via composer:
composer require spatie/laravel-model-states
Publishing the config file is optional:
php artisan vendor:publish --provider="Spatie\ModelStates\ModelStatesServiceProvider" --tag="model-states-config"
This is the default content of the config file:
return [
/*
* The fully qualified class name of the default transition.
*/
'default_transition' => Spatie\ModelStates\DefaultTransition::class,
];
How can I help you explore Laravel packages today?