PHPackages                             ibraheem-ghazi/stager - 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. ibraheem-ghazi/stager

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

ibraheem-ghazi/stager
=====================

Laravel state machine for eloquent

1.5.1(7y ago)1570MITPHPPHP &gt;=7.0.0

Since Apr 9Pushed 7y agoCompare

[ Source](https://github.com/ibraheem-ghazi/Laravel-Stager)[ Packagist](https://packagist.org/packages/ibraheem-ghazi/stager)[ RSS](/packages/ibraheem-ghazi-stager/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

Laravel Stager State Machine
============================

[](#laravel-stager-state-machine)

This is a Laravel 5.6 package for eloquent models. Its purpose is to add state machine functionalty to models

Features
========

[](#features)

- all state-machines in one config file
- states defined as name,value
- transitions from multiple status
- transition affect related model
- schedules run every X times you defined
- schedules transitions depending on state and last time state changed
- schedules support run command depending on state
- support shared trait for shared props and attribute or override {some} of stager methods
- support events before and after transitions
- support additional executions or extra conditions before access transition
- auto generate ide helper file for magic functions
- \[new\] guarded transitions
- \[new\] pre transition realtion status checker
- \[new\] added support for collection transitions

Installation
============

[](#installation)

```
composer require ibraheem-ghazi/stager
php artisan vendor:publish --provider="IbraheemGhazi\Stager\StagerServiceProvider"

```

Configuration
=============

[](#configuration)

- in order to add state machine you have to define it in `config/state-machine.php`

\#####Notes:

- each state define a constant by generator
- each state must have unique value for current model so it does not overlap others when get current state name.
- state-column and init-state attributes are optional which by default are state-column = state and init-state is by default first state
- each attribute key must be in kebab-case

```
