This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Document staete machine workflows for Laravel 5+

v1.7 2017-09-30 10:36 UTC

This package is not auto-updated.

Last update: 2021-09-18 11:57:04 UTC


This composer package enables you to attach state machine workflows to your Eloquent models in your Laravel 5+ applications, along with the optional ability to log transition state changes to a dedicated database table. The state machine and auditing is based on the Yohang/Finite package, along with trait gists from tortuetorche.


Begin by pulling in the package through Composer.

composer require mass6/laravel-state-workflows

Next, include the service provider within your config/app.php file.

'providers' => [


For any model that you want to attach a workflow to, use the StateMachineTrait in your model. Then, initialize the statement in the model constructor.

namespace App\Models;

class Order extends Model {
    use \Mass6\LaravelStateWorkflows\StateMachineTrait;
    public function __construct($attributes = [])

Next, if opting to use the transition auditing feature, run the migration to create the audit table.

To run the migrations from the package directly:

php artisan migrate --path=vendor/mass6/laravel-state-workflows/src/migrations

Or, publish the migration asset if you wish to include the migration in your own project:

php artisan vendor:publish --provider="Mass6\LaravelStateWorkflows\StateWorkflowsServiceProvider"