New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

stateforge/scenario-laravel

Laravel adapter for Stateforge Scenario Core – declarative, attribute-driven scenario execution for reproducible application state.
1,018

Larablocks Analysis

stateforge/scenario-laravel works with Laravel 12 (latest release 1.2.3, Nov 6, 2026).

Recommendation checks

Use with care

Use with care: meets 1 of 4 checks.

  • Latest release doesn't support Laravel 13, the current version
  • Released in the last 12 months (Nov 6, 2026)
  • 1,016 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Actively maintained
  • Last stable release: Nov 6, 2026.
  • 10 releases in the last 12 months.
  • First released: Apr 6, 2026.
  • Monthly downloads: 1,016.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.

Install
composer require stateforge/scenario-laravel
Latest Version:1.2.3
PHP:>=8.2
Laravel:12
License:BSD-3-Clause
Last Updated:Nov 6, 2026
Links: GitHub  ·  Packagist
Maintainer: laloona
Stateforge\Scenario\Laravel

CI PHPStan Stability Latest Version PHP Version License


Scenario Laravel

Laravel integration for Stateforge Scenario Core.

This package provides framework-specific integration for Laravel applications, enabling seamless scenario execution within PHPUnit tests and Artisan workflows.

It builds on top of stateforge/scenario-core and integrates with the Laravel container, Artisan console, and testing environment.

Requirements

Scenario Laravel requires the following:

Installation

This package is intended for local, develop and testing use only.

composer require --dev stateforge/scenario-laravel

After installation, run the setup command:

php artisan scenario:install

The installation command generates the required configuration files:

  • creates scenario/bootstrap.php for runtime bootstrapping
  • generates scenario.dist.xml for configuration
  • places the extension into phpunit.xml or phpunit.dist.xml

What This Package Provides

Scenario Laravel integrates Scenario Core with:

  • Laravel’s service container
  • Laravel Artisan console
  • Laravel application lifecycle
  • PHPUnit integration

Service Provider

The package automatically registers its service provider.

It handles:

  • registering console commands
  • wiring scenario services
  • integrating the Scenario runtime with Laravel

Database Reset

When using #[RefreshDatabase], the Laravel integration resets the database using Laravel’s migration system.

The default behavior:

  • runs migrate:fresh
  • optionally supports connection-specific resets

Applying Scenarios in Unit Tests

Scenarios can be applied declaratively using the #[ApplyScenario] attribute:

use Stateforge\Scenario\Core\Attribute\ApplyScenario;

#[ApplyScenario('my-scenario')]
final class MyTest extends TestCase
{
    #[ApplyScenario('my-second-scenario')]
    public function testSomethingImportant(): void
    {
        // scenario has already been applied, data can be tested
    }
}

Console Commands

Scenario Laravel registers dedicated Artisan commands within your application.

You can discover them using:

php artisan list scenario

Available commands include:

  • scenario:list – List available scenarios
  • scenario:apply – Apply a scenario manually
  • scenario:debug – Debug scenarios or unit tests
  • scenario:make – Generate a new scenario
  • scenario:install – Install Scenario into the project

Environment Restrictions

Scenario commands are intended for local, development and testing environments only.

By default, they are restricted to:

  • local
  • develop
  • testing

This can be configured via:

config('scenario.allowed_envs');

Next Steps

Alternatives to stateforge/scenario-laravel

laravel/pao

Agent-optimized output for PHP testing tools

36,386,213 736
spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

24,222,959 697
rawphp/warp

Warm-worker test engine for Laravel + Pest — boots the app once per process and...

11,158 1
fruitcake/phpunit-tia-laravel

Laravel integration for phpunit-tia: links tests to the views they render and th...

3,829 0
alvarodelera/pest-wp-plugin

Pest plugin for WordPress testing with SQLite support and zero-config setup

3,583 5

Version History

Version Released PHP Laravel License
1.2.3 >=8.2 ^12.0 BSD-3-Clause
1.2.2 >=8.2 ^12.0 BSD-3-Clause
1.2.1 >=8.2 ^12.0 BSD-3-Clause
1.2.0 >=8.2 ^12.0 BSD-3-Clause
1.1.1 >=8.2 ^12.0 BSD-3-Clause