Download the PHP package bornfreee/tactician-domain-events-bundle without Composer

On this page you can find all versions of the php package bornfreee/tactician-domain-events-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tactician-domain-events-bundle

Tactician Domain Events Symfony Bundle

Build Status Scrutinizer Code Quality Latest Stable Version

Symfony Bundle to integrate Tactician Domain Events library with Symfony project

Installation

Install via composer

Add bundle to AppKernel.php:

Configuration

On default event collector CollectsEventsFromEntities will be used, but sometimes you might record an event when entity doesn't change so the event is not collected. It's also true when an aggregate root is recording events for its child entities. To collect those events you need to use CollectsEventsFromAllEntitiesManagedByUnitOfWork That one collects events from all entities which are managed by Unit of Work. To use it you need to set collect_from_all_managed_entities on true:

Usage

This bundle allows you to automatically have Domain Events dispatched by EventDispatcher. It also allows to register event listeners and subscribers as the Symfony Services. You can register as many listeners as you want for each Domain Event.

First, we need to install the Tactician official Bundle to integrate the command bus library:

Then we need to configure Middleware to automatically record the Domain Events and dispatch them. We only want to handle the events themselves after the command has completely and successfully been handled. So we add the middleware that records the Domain Events before the Transaction middleware.

It means that as soon as transaction is completed, the Domain Events will be recorded:

Configuring Event Listeners

In order to add event listeners for dispatched Domain Events, we need to define services and the corresponded commands for them:

Notice the tag tactician.event_listener. The bundle automatically finds all services tagged with this tag and adds the listener to EventDispatcher.

By default, event listener shold have public __invoke function. If you want to have regular method name, it's possible to it to the service configuration:

This is all configuration you need to start using the Tactician command bus with Domain Events.

Let's have an example where we create a new user and a UserWasCreated domain event is dispatched:

As soon as this Entity is successfully created, the SendEmailAfterUserIsCreatedListener will be triggered.

Debugging

You can run the debug:tactician-domain-events command to get a list of all events with mapped listeners.

License

Copyright (c) 2017, Maks Rafalko

Under MIT license, read LICENSE file.


All versions of tactician-domain-events-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
symfony/config Version ^2.8|^3.0|^4.0|^5.0
symfony/http-kernel Version ^2.8|^3.0|^4.0|^5.0
symfony/dependency-injection Version ^2.8|^3.0|^4.0|^5.0
bornfree/tactician-doctrine-domain-events Version ^0.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bornfreee/tactician-domain-events-bundle contains the following files

Loading the files please wait ....