This bundle enables you to create league/pipeline pipelines via service configuration.
- PHP 8.2 or higher
- Symfony 5.x, 6.x, or 7.x
- league/pipeline ^1.0
$ composer require netresearch/pipeline-factoryIf you do not use Symfony Flex, you need to enable the bundle manually:
// config/bundles.php
return [
// ...
Netresearch\PipelineFactoryBundle\NetresearchPipelineFactoryBundle::class => ['all' => true],
];Use the pipeline factory via your service container configuration:
# config/services.yaml
services:
app.my.custom.pipeline:
factory: [ 'Netresearch\PipelineFactoryBundle\Pipeline\Factory', create ]
class: League\Pipeline\Pipeline
arguments:
$stages: !iterator [
'@App\Pipeline\Stages\Stage1',
'@App\Pipeline\Stages\Stage2',
'@App\Pipeline\Stages\Stage3',
]
# optional: set the pipeline processor
$processor: '@App\Pipeline\Processor\MyCustomProcessor'Alternatively you can pass in a collection of tagged services (e.g. tag them via autoconfiguration):
# config/services.yaml
services:
App\Pipeline\Stages\:
resource: '../src/Pipeline/Stages'
tags: [ 'app.my.custom.pipeline.stage' ]
app.my.custom.pipeline:
factory: [ 'Netresearch\PipelineFactoryBundle\Pipeline\Factory', create ]
class: League\Pipeline\Pipeline
arguments:
$stages: !tagged_iterator 'app.my.custom.pipeline.stage'Via priority, you can control the order of the stages in this case.
Run the test suite:
$ composer testGenerate code coverage report:
$ composer test-coverageThe coverage report will be available in the coverage/ directory. Open coverage/index.html in your browser to view detailed coverage information.
Use the following commands to ensure the source code conforms to our coding standards and guidelines:
composer phpcsto check PHP related files against the PSR-12 code stylecomposer rectorto automatically comply with coding standards, simplify and improve code, and perform migrations (rules defined in./rector.php)composer phpstanfor type and bug checking
Run the command composer analysis to run all static analysis checks at once.
Run all quality checks (analysis + tests):
$ composer quality