PHP code example of antismok / domain-events-publisher-bundle
1. Go to this page and download the library: Download antismok/domain-events-publisher-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
antismok / domain-events-publisher-bundle example snippets
declare(strict_types=1);
namespace Antismok\Identity\Application;
use Antismok\Identity\Domain\UserCreatedEvent;
class UserCreatedHandler
{
public function handle(UserCreatedEvent $event)
{
//....
}
}
declare(strict_types=1);
namespace Antismok\Identity\Domain\Model;
use Antismok\DomainEventPublisher\DomainEventPublisher;
use Antismok\Identity\Domain\UserCreatedEvent;
class User
{
public function register(string $id, string $login): void
{
//.....
DomainEventPublisher::getInstance()
->publish(new UserCreatedEvent($id, $login))
;
}
}