PHPackages                             christhompsontldr/laravel-fsm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. christhompsontldr/laravel-fsm

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

christhompsontldr/laravel-fsm
=============================

A robust, plug-and-play Finite State Machine (FSM) package for Laravel applications.

v1.0.5(1mo ago)8303[1 PRs](https://github.com/ChrisThompsonTLDR/laravel-fsm/pulls)MITPHPPHP ^8.3|^8.4CI passing

Since Oct 16Pushed 3w agoCompare

[ Source](https://github.com/ChrisThompsonTLDR/laravel-fsm)[ Packagist](https://packagist.org/packages/christhompsontldr/laravel-fsm)[ Docs](https://github.com/christhompsontldr/laravel-fsm)[ RSS](/packages/christhompsontldr-laravel-fsm/feed)WikiDiscussions main Synced today

READMEChangelog (6)Dependencies (28)Versions (12)Used By (0)

Laravel FSM
===========

[](#laravel-fsm)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e4f04ebc9f7f66675177ce2440d1e68dbda653d25b6ba1595b93054f365cd754/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636872697374686f6d70736f6e746c64722f6c61726176656c2d66736d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/christhompsontldr/laravel-fsm)[![License](https://camo.githubusercontent.com/b3965c14e3b8b2b42e150280b4d6b9bfea221e15ffc0975909786d7a6eec5f57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636872697374686f6d70736f6e746c64722f6c61726176656c2d66736d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/christhompsontldr/laravel-fsm)[![PHP Version](https://camo.githubusercontent.com/37e846cd859d02a5f6d4b8da92179df6bfb1cb8f8fea638c66a5170bc42c2b5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f636872697374686f6d70736f6e746c64722f6c61726176656c2d66736d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/christhompsontldr/laravel-fsm)

[![Coverage Status](https://camo.githubusercontent.com/3c62d399a6ed9ec8600e32f88d36ce97589556abe384a5ceac296909fe5752ea/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f436872697354686f6d70736f6e544c44522f6c61726176656c2d66736d2f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/ChrisThompsonTLDR/laravel-fsm?branch=main)

[![Laravel Version](https://camo.githubusercontent.com/19d5bb0370853f3f5f64da8e47f7b2e14803b7fa5f7c8d04e347ac6849edb9ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322e782d7265642e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![PHPStan](https://camo.githubusercontent.com/bd9ade72e1432be27a5e9795f1c89847099d8cfce66b8bf3b280f8e8baf44b9f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c2532304d61782d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://phpstan.org)[![Pint](https://camo.githubusercontent.com/34d74151afc9489d85ae3807cc595d90bf451d35105b6414702dbbae150ea4ec/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f64652532305374796c652d4c61726176656c25323050696e742d6666363962342e7376673f7374796c653d666c61742d737175617265)](https://laravel.com/docs/pint)

A robust, plug-and-play Finite State Machine (FSM) package for Laravel applications with advanced features like guards, actions, callbacks, state machines, and comprehensive logging.

Features
--------

[](#features)

- 🚀 **Zero-config setup** - Works out of the box with sensible defaults
- 🔒 **Guards** - Control transitions with custom validation logic
- ⚡ **Actions** - Execute code when transitioning between states
- 📝 **Callbacks** - Hook into state entry/exit events
- 🔄 **Event-driven** - Integrates with Laravel's event system
- 📊 **Logging** - Comprehensive transition logging for audit trails
- 🎯 **State validation** - Prevent invalid state transitions
- 🔧 **Extensible** - Easy to customize and extend
- 🎨 **Fluent API** - Clean, expressive syntax
- 📚 **Multiple FSM support** - Define different state machines per model column
- ⚡ **Performance** - Caching and optimization built-in

What It Does
------------

[](#what-it-does)

This package allows you to manage state transitions in your Laravel applications with ease. Define states, transitions, and business logic that governs how your models can change state.

Perfect for:

- Order workflows (pending → paid → shipped → delivered)
- User verification flows (unverified → pending → verified)
- Content moderation (draft → review → published)
- Issue tracking (open → in-progress → resolved)
- And any other stateful business process!

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require christhompsontldr/laravel-fsm
```

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="Fsm\FsmServiceProvider" --tag="fsm-config"
```

This will create a `config/fsm.php` file where you can customize:

```
