MsgPHP is a project that aims to provide reusable domain layers for your application. It has a low development time overhead and avoids being overly opinionated.

Blog posts

In practice

<?php

$bus->dispatch(new CreateData(new Data('🐱')));

class CreateDataHandler
{
    // ...

    public function __invoke(CreateData $command)
    {
        // do work

        $this->bus->dispatch(new DataCreated($command->data));
    }
}

class LogCreatedData
{
    public function __invoke(DataCreated $event)
    {
        // log created data from $event->data
    }
}
© 2017 Roland Franssen