2017 © Pedro Peláez
 

library cqrs-php

Implements CQRS (for DDD in PHP)

image

black/cqrs-php

Implements CQRS (for DDD in PHP)

  • Sunday, January 3, 2016
  • by pocky
  • Repository
  • 1 Watchers
  • 4 Stars
  • 201 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

CQRS PHP

CQRS in PHP is a simple project (a folder structure) for your project build with Domain Driven Design., (*1)

Latest Stable Version Total Downloads, (*2)

Installation

The recomanded way to install CQRS in PHP is through Composer:, (*3)

{
    "require": {
        "black/cqrs-php": "@stable"
    }
}

Protip: You should browse the black/cqrs-php page to choose a stable version to use, avoid the @stable meta constraint., (*4)

Why?

I want to use a very basic library for CQRS without Event Sourcing. There is one Bus, register your handler with the related command and go for it!, (*5)

Usage

1 - Create a Command implementing Black\DDD\CQRSinPHP\Infrastructure\CQRS\Command
2 - Create an Handler implementing Black\DDD\CQRSinPHP\Infrastructure\CQRS\CommandHandler
3 - Register the Handler/Command to the Bus, (*6)

<?php

$bus = new Black\DDD\CQRSinPHP\Infrastructure\CQRS\Bus;
$handler = new My\Handler();

$bus->register('My\Command', $handler);

// Do stuff
$command = new My\Command($foo, $bar);
$bus->handle($command);

SymfonyBundle

Register the bundle:, (*7)

``` php <?php // app/AppKernel.php, (*8)

public function registerBundles() { $bundles = array( // ... new Black\Bundle\CQRSBundle\BlackCQRSBundle(), ); }, (*9)


Declare your handler as a service and add this tag: ```yaml services: my.handler: class: 'My\Handler' tags: - { name: black_cqrs.handler, command: "My\Command" }

And use it:, (*10)

<?php

public function __construct(Black\DDD\CQRSinPHP\Infrastructure\CQRS\Bus $bus)
{
    $this->bus = $bus;
}

public function myFunction($foo, $bar)
{
    $command = new My\Command($foo, $bar);
    $this->bus->handle($command);
}

Contributing

This project is a work in progress so don't hesitate to see CONTRIBUTING file and submit your PR., (*11)

Credits

The code is heavily inspired by Benjamin Eberlei blog posts who did a very great job on many projects (including Doctrine and litecqrs-php., (*12)

This README is heavily inspired by Hateoas library by the great @willdurand. This guy needs your PR for the sake of the REST in PHP., (*13)

Alexandre "pocky" Balmes alexandre@lablackroom.com. Send me Flattrs if you love my work, buy me gift or hire me!, (*14)

License

CQRS in PHP is released under the MIT License. See the bundled LICENSE file for details., (*15)

The Versions

03/01 2016

dev-master

9999999-dev http://www.lablackroom.com

Implements CQRS (for DDD in PHP)

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

cqrs ddd black-project

22/10 2014

v1.0.2

1.0.2.0 http://www.lablackroom.com

Implements CQRS (for DDD in PHP)

  Sources   Download

The Requires

  • php >=5.4.0

 

cqrs ddd black-project

27/08 2014

v1.0.1

1.0.1.0

Implements CQRS (for DDD in PHP)

  Sources   Download

The Requires

  • php >=5.4.0

 

17/08 2014

v1.0.0

1.0.0.0

Implements CQRS (for DDD in PHP)

  Sources   Download

The Requires

  • php >=5.4.0