Download the PHP package stateforge/scenario-core without Composer
On this page you can find all versions of the php package stateforge/scenario-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stateforge/scenario-core
More information about stateforge/scenario-core
Files in stateforge/scenario-core
Package scenario-core
Short Description Core library for declarative, attribute-driven scenario orchestration for reproducible test data states in PHP.
License BSD-3-Clause
Homepage https://github.com/laloona/scenario-core
Informations about the package scenario-core
Scenario Core
Scenario Core is a declarative, attribute-driven framework for reproducible data states in PHP. It replaces manual test setup and fixture orchestration with structured, metadata-based scenario execution.
Requirements
Scenario Core requires the following:
- PHP >= 8.2.
- ext-dom *
- phpunit/phpunit >= 11
Installation
This package is intended for test and development use only.
Install it via Composer as a development dependency.
PHPUnit Integration
It integrates seamlessly with PHPUnit-based test suites and console tooling.
To enable scenario processing in your test suite, register the PHPUnit
extension in your phpunit.xml:
The extension integrates with the PHPUnit lifecycle and ensures that all scenario-related attributes are processed before test execution.
Defining a Scenario
A scenario represents a reproducible application data state. Scenarios:
- Implement
ScenarioInterface - Are marked with
- Are automatically discovered and registered
No manual registry interaction is required.
Applying a Scenario in a Unit Test
Scenarios can be applied declaratively using the attribute:
Multiple scenarios may be applied at class or method level. A scenario class can apply other scenarios.
Example Use Case
Resetting the Database
Use the attribute to reset the database before scenario execution:
This ensures clean and deterministic test state. This can be applied on class or method level and on Unit Tests or Scenario Classes.
The
#[RefreshDatabase]attribute triggers a database reset hook. Scenario Core itself does not implement database logic, as it remains framework-agnostic. Instead, a custom PHP file can be configured to perform the reset according to your application's infrastructure.
Console Usage
Scenarios can also be executed directly from the console:
This allows:
- local state setup
- reproducible development fixtures
- CI preparation workflows
Get all available CLI Commands:
Framework Integration
Scenario Core is framework-agnostic and can be integrated into any PHP application.
It works particularly well with:
- Symfony-based applications: (stateforge/scenario-symfony)
- Laravel-based applications: (stateforge/scenario-laravel)
- Custom test infrastructures using PHPUnit
Framework-specific integration layers may be provided separately.
Next Steps
- Getting Started
- Configuration
- Scenarios
- Parameter Types
- CLI Usage
- Testing with PHPUnit
- Recipes
All versions of scenario-core with dependencies
ext-dom Version *
phpunit/phpunit Version ^11.5.50 || ^12.5.22 || ^13.1.6