PHPackages                             flipjms/laravel-scenarios - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. flipjms/laravel-scenarios

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

flipjms/laravel-scenarios
=========================

An easier way to put your application into different states for easy debugging/development

v0.0.5(10mo ago)132.1k↓50%1MITPHPPHP ^8.1

Since Aug 22Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/Flipjms/laravel-scenarios)[ Packagist](https://packagist.org/packages/flipjms/laravel-scenarios)[ Docs](https://github.com/flipjms/laravel-scenarios)[ RSS](/packages/flipjms-laravel-scenarios/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Scenarios
=================

[](#laravel-scenarios)

This little package helps you set your Laravel application into a given state/scenario.

Let's say that you want to finally fix that pesky edge case bug and for that you need to have your application in a very specific state. Example:

- you need to have a user with role X
- your user needs to have bought two products
- the payment for the second product needs to have status Y
- Another condition
- Extra condition
- Last condition

With this package you can create a new Scenario, write the code needed to have the application in the state above, and run the command to set the scenario.

Voilá! Now you have a nice file descriptive file that sets your application into the right state so you can easily develop against and reset everytime you need it.

Not only that, but it also makes it easy for other people to quickly check which scenarios are available, and use them.

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

[](#installation)

You can install the package via composer:

```
composer require flipjms/laravel-scenarios
```

Go to you `composer.json` and add the following:

```
"autoload": {
    "psr-4": {
      "Database\\Scenarios\\": "database/scenarios/"
    }
},
```

Usage
-----

[](#usage)

**To create a new scenario:**

```
php artisan make:scenario NewScenarioName
```

Be descriptive with your names. Do not be afraid of long names.

The file will be created at `./database/scenarios/`

Set an alias and a nice description for it. Then on the `execute` method add the necessary code to place your application into the desired state. Usually you do that by running factories, seeders, etc...

The `output` method allows you to output information to the console once the scenario has been set. This is useful to display information that you might need, like a user login, or an url that you might need to visit. All the [Laravel Output IO commands](https://laravel.com/docs/9.x/artisan#writing-output) are available apart from the progress bar. You can also use [Termwind](https://github.com/nunomaduro/termwind) for a prettier output.

**To set a scenario**

```
php artisan scenarios:set

or

php artisan scenarios:set scenario-alias
```

More often than not, you want to clean your database. If that's the case, you can use the `--fresh` option:

```
php artisan scenarios:set --fresh

or

php artisan scenarios:set scenario-alias --fresh
```

Questions
---------

[](#questions)

- Why not just use seeders?
    - IMHO seeders are nice to put your application into a default state not specific ones.
- Why not use commands?
    - You can definitely use commands. I've certainly done so. Nonetheless, I like to see commands as business logic, whereas scenarios is something you need while developing/debugging. This way I can keep my commands folder clean, and my scenarios neatly organized in their own folder.

Credits
-------

[](#credits)

- [Filipe Santos](https://github.com/flipjms)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance54

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

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 ~262 days

Total

5

Last Release

315d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/10bf43f831caf63d358e713c1aa7811329ff0d6e342643222917bc2f8df06f6a?d=identicon)[flipjms](/maintainers/flipjms)

---

Top Contributors

[![Flipjms](https://avatars.githubusercontent.com/u/8956652?v=4)](https://github.com/Flipjms "Flipjms (5 commits)")

---

Tags

laravelscenariosstatelaravellaravel-scenariosflipjms

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/flipjms-laravel-scenarios/health.svg)

```
[![Health](https://phpackages.com/badges/flipjms-laravel-scenarios/health.svg)](https://phpackages.com/packages/flipjms-laravel-scenarios)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[worksome/envy

Automatically keep your .env files in sync.

6871.8M](/packages/worksome-envy)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[recca0120/laravel-tracy

A Laravel Package to integrate Nette Tracy Debugger

388283.0k3](/packages/recca0120-laravel-tracy)[stephenjude/filament-debugger

About

102125.4k2](/packages/stephenjude-filament-debugger)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)

PHPackages © 2026

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