Download the PHP package star/domain-event without Composer

On this page you can find all versions of the php package star/domain-event. 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 domain-event

domain-event

Build Status

Small implementation of the aggregate root in ddd. The AggregateRoot implementation triggers events that can be collected for publishing by an implementation of EventPublisher.

Installation

composer require star/domain-event

Usage

  1. Make your class inherit the AggregateRoot class.

  2. Create the event for the mutation.

  3. Create a named constructor (static method), or a mutation method.

  4. Create the callback method on the AggregateRoot that would be used to set the state after an event mutation.

Listening to an event

When you wish to perform an operation after an event was dispatched by the EventPublisher, you need to define your listener:

The listener needs to be given to the publisher, so that he can send the event.

Warning: Be advised that events will be removed from aggregate once collected, to avoid republishing the same event twice.

We currently support third party adapters to allow you to plug-in the library into your infrastructure.

Naming standard

The events method on the AggregateRoot children must be prefixed with on and followed by the event name. ie. For an event class named StuffWasDone the aggregate should have a method:

Note: The callback method can be changed to another format, by overriding the AggregateRoot::getEventMethod().

Message bus

The package adds the ability to dispatch messages (Command and Query). Compared to the EventPubliser, the CommandBus and QueryBus have different usages.

(Example of usage)

Example

The blog example shows a use case for a blog application.

Symfony usage

Using a Symfony application, you may use the provided compiler passes to use the buses.

Once registered, three new tags will be available:

The tags star.command_handler and star.query_handler have an optional attribute message to specify the message FQCN that will be mapped to this handler. By default the system will try to resolve the same FQCN as the handler, without the Handler suffix.

Note: In both cases, omitting the message attributes would result in the same behavior.

Event store

Event stores are where your events will be persisted. You define which platform is used by extending the provided store.

Example with DBALEventStore.


All versions of domain-event with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.0
ext-json Version *
beberlei/assert Version ^3.3
webmozart/assert Version ^1.1
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 star/domain-event contains the following files

Loading the files please wait ....