PHPackages                             nicwortel/command-pipeline - 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. nicwortel/command-pipeline

ActiveLibrary

nicwortel/command-pipeline
==========================

A command pipeline for PHP

v0.4.0(5y ago)01931MITPHPPHP ^7.4 || ^8.0

Since Sep 27Pushed 5y agoCompare

[ Source](https://github.com/nicwortel/command-pipeline)[ Packagist](https://packagist.org/packages/nicwortel/command-pipeline)[ RSS](/packages/nicwortel-command-pipeline/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (19)Versions (6)Used By (0)

Command Pipeline
================

[](#command-pipeline)

[![Build status](https://camo.githubusercontent.com/5fab54a17a2aebeb644b1632d6f33701759ce748f47cb7743ac93b39ba52548a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f6e6963776f7274656c2f636f6d6d616e642d706970656c696e65)](https://travis-ci.com/nicwortel/command-pipeline)[![License](https://camo.githubusercontent.com/0d91d4325da69aa41bb7a5e470e9cc6db02ffb17d961dce424682b033c49757f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e6963776f7274656c2f636f6d6d616e642d706970656c696e65)](https://github.com/nicwortel/command-pipeline/blob/master/LICENSE.txt)[![Required PHP version](https://camo.githubusercontent.com/256199d43f92a383af5b088460f54528323a31da99440b2a5b160d22706daa53/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e6963776f7274656c2f636f6d6d616e642d706970656c696e65)](https://github.com/nicwortel/command-pipeline/blob/master/composer.json)[![Current version](https://camo.githubusercontent.com/819c63204a17ca361f27bb2d38ed0a50250a9248d9bde66ed9544d828606b44b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6963776f7274656c2f636f6d6d616e642d706970656c696e65)](https://packagist.org/packages/nicwortel/command-pipeline)

An in-memory Command Pipeline implementation for PHP. A command pipeline handles cross-cutting concerns in a CQRS application that works with command objects, such as validation of commands, authorization, logging, etc.

Commands are processed in a linear process. The return value of each stage is passed to the next. A stage can only prevent the next stage from being executed by throwing an exception.

The concept of the command pipeline is loosely based on the [Pipes and Filters](https://www.enterpriseintegrationpatterns.com/patterns/messaging/PipesAndFilters.html)pattern.

Features
--------

[](#features)

- Command validation
- Command authorization
- Wrapping command handling in a Doctrine database transaction
- Dispatching emitted domain events to an event bus

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

[](#installation)

```
composer require nicwortel/command-pipeline
```

If you are using Symfony, enable the CommandPipelineBundle:

```
// config/bundles.php

return [
    // ...
    NicWortel\CommandPipeline\Bundle\CommandPipelineBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

Fetch the `command_pipeline` service from the service container or (recommended) inject the `CommandPipeline` into your application code:

```
