2017 © Pedro Peláez
 

library car

A PHP implementation of the command bus pattern for DDD

image

maximecolin/car

A PHP implementation of the command bus pattern for DDD

  • Saturday, January 10, 2015
  • by maximecolin
  • Repository
  • 2 Watchers
  • 8 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Car

Car is a PHP implementation of the Command Bus pattern for DDD., (*1)

Build Status, (*2)

Disclaimer

This is a very basic and simple implementation. It has to grow up :), (*3)

Installation

composer require maximecolin/car

Purpose

The aim of the command bus pattern is to isolate your domain code in atomic, testable and reusable classes and to execute them through a dedicated service., (*4)

Usage

A command is an order. It can contains data you need. Attributes can be set on construct, fill through a form, set by other services, ..., (*5)

class CreateArticleCommand implements CommandInterface
{
    public $title;
    public $content;

    public function __construct($title, $content)
    {
        $this->title   = $title;
        $this->content = $content;
    }
}

Create an handler which will process your command., (*6)

class CreateCommandHandler implements CommandHandlerInterface
{
    public function handle(CommandInterface $command)
    {
        // Place here you domain code which create an article ...
    }
}
// Usually, have a service to get the bus
$bus = new CommandBus();
$bus->addResolver(new ClassNameResolver());

$command = new CreateArticleCommand('My article name', 'My article content');

$bus->execute($command);

Comming soon

Event sourcing integration., (*7)

The Versions

10/01 2015

dev-master

9999999-dev http://www.maximecolin.fr

A PHP implementation of the command bus pattern for DDD

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

command bus pattern cqrs ddd

17/11 2014

1.0.0

1.0.0.0 http://www.maximecolin.fr

A PHP implementation of the command bus pattern for DDD

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

command bus pattern cqrs ddd