PHPackages                             asz/statemm - 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. asz/statemm

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

asz/statemm
===========

manage model state

v1.2(4y ago)113MITPHPPHP ^7.3|^8.0

Since Jul 16Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ahmadzreqat/StateMM)[ Packagist](https://packagist.org/packages/asz/statemm)[ RSS](/packages/asz-statemm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Laravel Model State
===================

[](#laravel-model-state)

[![](https://camo.githubusercontent.com/eb88d37243057faf19e1b551de90d81e418c7ce3d9879698ed1810478110e60b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f61686d61647a72657161742f73746174654d4d)](https://camo.githubusercontent.com/eb88d37243057faf19e1b551de90d81e418c7ce3d9879698ed1810478110e60b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f61686d61647a72657161742f73746174654d4d)[![](https://camo.githubusercontent.com/e15f4fa4684dee776917a23d38dc8ee465b7a547d6921cfafdbab0f737f6da49/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f61686d61647a72657161742f73746174654d4d)](https://camo.githubusercontent.com/e15f4fa4684dee776917a23d38dc8ee465b7a547d6921cfafdbab0f737f6da49/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f61686d61647a72657161742f73746174654d4d)[![](https://camo.githubusercontent.com/352d2c48b948684b0dfa912849672bf202a3410308f0c85acbedf45b87604376/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61686d61647a72657161742f73746174654d4d)](https://camo.githubusercontent.com/352d2c48b948684b0dfa912849672bf202a3410308f0c85acbedf45b87604376/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61686d61647a72657161742f73746174654d4d)[![](https://camo.githubusercontent.com/c2c549ade97d693f3a45dd9a47befa35337101da52bc48e7bf0433e04b53ad2b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f77617463686572732f61686d61647a72657161742f73746174654d4d3f7374796c653d736f6369616c)](https://camo.githubusercontent.com/c2c549ade97d693f3a45dd9a47befa35337101da52bc48e7bf0433e04b53ad2b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f77617463686572732f61686d61647a72657161742f73746174654d4d3f7374796c653d736f6369616c)

Overview
--------

[](#overview)

- This is a Laravel package to manage model state

Installation :
--------------

[](#installation-)

You can install ` asz/statemm` via Composer by adding `" asz/statemm": "^1.1"`as requirement to your composer.json. OR :

```
composer require asz/statemm
```

- Then :

```
composer dump-autoload
```

### Service Provider:

[](#service-provider)

go to your config/app.php file and add :

```
 statemm\StateServiceProvider::class ,
```

#### adding interface to model

[](#adding-interface-to-model)

```
class Product extends Model implements hasState
```

#### use command line to create a new state for your model

[](#use-command-line-to-create-a-new-state-for-your-model)

```
$ php artisan state:make activated --dir=productStateContainer
```

```
add method stubs in your model:
 public function initialState()
    {
         //set your initial state after generated
        // TODO: Implement initialState() method.

        return new ActivatedState();
    }
```

Test Unit
---------

[](#test-unit)

```
    public function testCanDeactivateProduct()
    {

        $product = new product();

       // the product is active and the initial state will check to
       // $this->transitionTo( new DeactivatedState());

        $context = new Context($product->where(['id' => 4])->first());

       // if true the proceed function will go to next state
       // which is deactivatedState and execute the query or what
       // you want todo
       // the deactivated has query to deactivate the given product

       $context->proceed();
       self::assertEquals(StateEnum::DEACTIVATED_STATE, $context->getModel()->state);
    }

    ```
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

1766d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ed3074af3aa753021268738d30cc4abaccb5724b3bf47a29d57111d27b29290?d=identicon)[ahmadzreqat](/maintainers/ahmadzreqat)

---

Top Contributors

[![ahmadzreqat](https://avatars.githubusercontent.com/u/61236176?v=4)](https://github.com/ahmadzreqat "ahmadzreqat (12 commits)")

### Embed Badge

![Health badge](/badges/asz-statemm/health.svg)

```
[![Health](https://phpackages.com/badges/asz-statemm/health.svg)](https://phpackages.com/packages/asz-statemm)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
