PHPackages                             stateforge/scenario-symfony - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. stateforge/scenario-symfony

ActiveSymfony-bundle[Testing &amp; Quality](/categories/testing)

stateforge/scenario-symfony
===========================

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

1.1.2(1w ago)0503BSD-3-ClausePHPPHP &gt;=8.2CI passing

Since Apr 6Pushed 1w agoCompare

[ Source](https://github.com/laloona/scenario-symfony)[ Packagist](https://packagist.org/packages/stateforge/scenario-symfony)[ Docs](https://github.com/laloona/scenario-symfony)[ RSS](/packages/stateforge-scenario-symfony/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (31)Versions (10)Used By (0)

[![Stateforge\Scenario\Symfony](docs/scenario.png)](docs/scenario.png)

[![CI](https://github.com/laloona/scenario-symfony/actions/workflows/ci.yml/badge.svg)](https://github.com/laloona/scenario-symfony/actions/workflows/ci.yml/badge.svg)[![PHPStan](https://camo.githubusercontent.com/022b70e6631d055205dfebf2aa7e53b3f63e7a3ea04a18e86429f279e29a29f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c25323031302d627269676874677265656e)](https://camo.githubusercontent.com/022b70e6631d055205dfebf2aa7e53b3f63e7a3ea04a18e86429f279e29a29f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c25323031302d627269676874677265656e)[![Stability](https://camo.githubusercontent.com/ab8ef3fe8abaa0d51cd12f22a8a8159f8022515a030b700ab4a35367d281028f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73746162696c6974792d737461626c652d627269676874677265656e)](https://camo.githubusercontent.com/ab8ef3fe8abaa0d51cd12f22a8a8159f8022515a030b700ab4a35367d281028f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73746162696c6974792d737461626c652d627269676874677265656e)[![Latest Version](https://camo.githubusercontent.com/07baa1bf2711190b1356a662f0e3d07a8c40db2baa19a82c64ac6f6ade4e3139/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374617465666f7267652f7363656e6172696f2d73796d666f6e79)](https://camo.githubusercontent.com/07baa1bf2711190b1356a662f0e3d07a8c40db2baa19a82c64ac6f6ade4e3139/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374617465666f7267652f7363656e6172696f2d73796d666f6e79)[![PHP Version](https://camo.githubusercontent.com/58861816126cd7a794bd99045d0c7cd611b9ce4bfb9da73b8e8c4e2ca7d864ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7374617465666f7267652f7363656e6172696f2d73796d666f6e79)](https://camo.githubusercontent.com/58861816126cd7a794bd99045d0c7cd611b9ce4bfb9da73b8e8c4e2ca7d864ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7374617465666f7267652f7363656e6172696f2d73796d666f6e79)[![License](https://camo.githubusercontent.com/aa6461f1aa87a0429e52a720c0fe5159b73f169a984185d7135cbe2d8438b294/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c616c6f6f6e612f7363656e6172696f2d73796d666f6e79)](https://camo.githubusercontent.com/aa6461f1aa87a0429e52a720c0fe5159b73f169a984185d7135cbe2d8438b294/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c616c6f6f6e612f7363656e6172696f2d73796d666f6e79)

---

Scenario Symfony
================

[](#scenario-symfony)

Symfony integration for Stateforge Scenario Core.

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

It builds on top of `stateforge/scenario-core` and integrates with the Symfony runtime and Doctrine ORM.

Requirements
------------

[](#requirements)

Scenario Symfony requires the following:

- PHP &gt;= 8.2.
- Symfony 6.4+ or 7+
- [stateforge/scenario-core](https://github.com/laloona/scenario-core)

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

[](#installation)

> This package is intended for test and development use only.

```
composer require --dev stateforge/scenario-symfony
```

After installation, run the setup command:

```
php bin/console scenario:install
```

The installation command generates the required configuration files:

- creates the `scenario.yaml` package configuration
- enables the symfony console scenario commands
- generates the `scenario.dist.xml`for configuration
- places the extendsion into `phpunit.dist.xml` or `phpunit.xml`

What This Package Provides
--------------------------

[](#what-this-package-provides)

Scenario Symfony integrates Scenario Core with:

- Symfony’s service container
- Doctrine ORM (for database reset handling)
- Symfony Console
- Symfony test kernel lifecycle

Enabling the Bundle
-------------------

[](#enabling-the-bundle)

Register the bundle in your Symfony application:

```
// config/bundles.php

return [
    Stateforge\Scenario\Symfony\ScenarioSymfonyBundle::class => ['dev' => true, 'test' => true],
];
```

The bundle automatically:

- registers attribute handlers
- wires scenario services
- configures database reset handling
- integrates with PHPUnit extension

Database Reset (Doctrine Integration)
-------------------------------------

[](#database-reset-doctrine-integration)

When using `#[RefreshDatabase]`, the Symfony integration resets the database using Doctrine.

The default behavior:

- recreate the database
- executed all migrations

Applying Scenarios in Unit Tests
--------------------------------

[](#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
----------------

[](#console-commands)

Scenario Symfony registers dedicated console commands within your Symfony application.

You can discover them using:

```
php bin/console list scenario
```

Next Steps
----------

[](#next-steps)

- [Getting Started](docs/getting-started.md)
- [Configuration](docs/configuration.md)
- [Scenarios](docs/scenarios.md)
- [Parameter Types](docs/parameter-types.md)
- [CLI Usage](docs/cli.md)
- [Testing with PHPUnit](docs/testing-with-phpunit.md)
- [Recipes](docs/recipes.md)

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance98

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

Total

9

Last Release

13d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/14c160ba8dd9d6012afbd54bd9cbd59c72cfc963a68c820589c8c01fa9c5c7ea?d=identicon)[laloona](/maintainers/laloona)

---

Top Contributors

[![laloona](https://avatars.githubusercontent.com/u/5313072?v=4)](https://github.com/laloona "laloona (161 commits)")

---

Tags

testingphpunitsymfonyfixturesstatescenariotest data

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/stateforge-scenario-symfony/health.svg)

```
[![Health](https://phpackages.com/badges/stateforge-scenario-symfony/health.svg)](https://phpackages.com/packages/stateforge-scenario-symfony)
```

###  Alternatives

[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k17.8k](/packages/prestashop-prestashop)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)

PHPackages © 2026

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