2017 © Pedro Peláez
 

library domain-events

Domain events implementation

image

itmedia/domain-events

Domain events implementation

  • Thursday, June 7, 2018
  • by by25
  • Repository
  • 1 Watchers
  • 1 Stars
  • 142 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 4 % Grown

The README.md

Domain Events

Domain Events Implementation, (*1)

Install

composer require itmedia/domain-events, (*2)

How to use

DomainEvent:, (*3)

<?php

use Itmedia\DomainEvents\Event\DomainEvent;

class AccountRegistrationEvent implements DomainEvent
{
    /**
     * @var Account
     */
    private $account;


    public function __construct(Account $account)
    {
        $this->account = $account;
    }


    public function getName():string
    {
        return 'account_register';
    }

    // ...

}

Entity implement interface DomainEventPublisher :, (*4)

<?php

use Itmedia\DomainEvents\Publisher\DomainEventPublisher;
use Itmedia\DomainEvents\Publisher\DomainEventPublisherTrait;

class Account implements DomainEventPublisher
{
    use DomainEventPublisherTrait; // Helper trait

    public static function register($email)
    {
        $account = new self();

        //...

        $account->pushEvent(new AccountRegistrationEvent($account));

        // Checked single event
        $account->pushSingleEvent(new MyEvent($account));
        $account->pushSingleEvent(new MyEvent($account));

        return $account;
    }


}

Use Doctrine ORM and Symfony events

Translation domain-event to symfony events on Doctrine postFlush() action:, (*5)


# services.yml services: # Translate domain event to symfony events Itmedia\DomainEvents\Bridge\SymfonyDomainEventTranslatorDispatcher: arguments: ['@event_dispatcher', '@logger', '%kernel.debug%'] # Handle domain-events Itmedia\DomainEvents\Bridge\DoctrineDomainEventsHandler: arguments: ['@Itmedia\DomainEvents\Bridge\SymfonyDomainEventTranslatorDispatcher'] tags: - { name: doctrine.event_listener, event: postFlush } - { name: doctrine.event_listener, event: preFlush }

The Versions

07/06 2018

dev-master

9999999-dev https://github.com/by25/DomainEvents

Domain events implementation

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

The Development Requires

by Andrei Kulikovski

07/06 2018

dev-develop

dev-develop https://github.com/by25/DomainEvents

Domain events implementation

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

The Development Requires

by Andrei Kulikovski

07/06 2018

v0.4.0

0.4.0.0 https://github.com/by25/DomainEvents

Domain events implementation

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

The Development Requires

by Andrei Kulikovski

07/07 2017

v0.3.0

0.3.0.0 https://github.com/by25/DomainEvents

Domain events implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

28/04 2017

v0.2.0

0.2.0.0 https://github.com/by25/CommandBusBundle

Domain events implementation

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

02/03 2017

v0.1.2

0.1.2.0 https://github.com/by25/CommandBusBundle

Domain events implementation

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

05/02 2017

v0.1.1

0.1.1.0 https://github.com/by25/CommandBusBundle

Domain events implementation

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

03/02 2017

v0.1.0

0.1.0.0 https://github.com/by25/CommandBusBundle

Domain events implementation

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires