Download the PHP package brueggemann/esf without Composer

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

EventSourcingFoundation

Installing :

Using Composer - execute

Setup :

Register the ESFoundationServiceProvider in the bootstrap/app.php

For the ESF Facade uncomment:

For Redis the RedisServiceProvider is needed:

and the correct configuration has to be loaded:

In config/database.php a configuration similar to this is needed:

.env

The QueryRepository, EventStore, AggregateProjectionRepository and EventBus have both in memory and redis implementations.

Artisan :

There are a few Artisan Commands to help create the basic classes needed.

Usage :

Commands :

The entrypoint to the Event Sourced part of your application should be a CommandHandler.

If an AggregateProjectionRepository is needed for the CommandHandler add

If a CommandBus is in use, the CommandHandler has to be registered in the AppServiceProvider:

In the handleCOMMAND methods of the created CommandHandler an AggregateProjection can be loaded either by:

or if the aggregateProjectionRepository is injected in the constructor

Events can be either stored with:

or if the eventStore is injected in the constructor

In the created Command classes rules may be defined in the standart laravel validation way:

A Commands constructor takes any form of payload and validates it against the requirements of the defined rules() method.

Best is to define a named array as payload:

It is possible to either retrieve the payload as a whole:

or by key:

A CommandHandler is either called direcly:

or using the COMMANDBUS:

Aggregates :

Aggregates are split into three parts:

If a Validator is needed for the AggregateRoot add:

In the applyThatEVENT methods of the created AggregateRoot class the data from the $EVENT can be applied to the $AGGREGATEROOTPROJECTION

The created Event class works similar to the Command class. Rules may be defined, that determine the events payload validation.

If similar Rules are valid both for a Command and an Event it is recommended to use a ValueObject to represent both the rules and a value per instance.

These rules then can be imported into the COMMAND or/and EVENT:

If created the AggregateRootValidator class can prevent an Event on being applied to an AggregateRootProjection by returning false when a given requirement of the AggregateProjection is not fulfilled. When the validation fails a FailedValidation exception is thrown.

The created AggregateRootProjection represents a state of an Aggregate. It contains multiple instantiated ValueObjects.

To apply an Event to an AggregateRootProjection using the AggregateRoots logic there are multiple options:

In 1 and 2 it is possible to choose the AggregateRoots logic, where in 3 the default logic is used.

Every Event that is applied to an AggregateRootProjection is saved and can be retrieved

These Events then are commitable via the EventBus or if needed directly via the EventStore

Queries :

Since there are no means of retrieving Events or even Aggregates based on a specific pattern, like the where clause in SQL the accumulation of data is done via Queries

A Query should represent a page or view. To manage Queries the QueryRepository is needed.

The add method saves a key-value pair. If the value is updated, a new entry under the same key is inserted.

To retrieve a query the get method is used. If only the key is provided, the most recent query is returned. If additionally an index is provided, the corresponding older query is returned.

The QueryRepository can be used to save data of long lasting calculations, crawlers or only indirectly persisted data.

EventListener :

The EventListener is a basic implementation of the listener pattern. Any EventListener needs to be subscribed to the EventBus it is supposed to be listening on. A good place to do this is in the AppServiceProvider:

If synchronus handling of eventdata is required, but cannot be done in an AggregateRoot, this is a good place to create and update a query.


All versions of esf with dependencies

PHP Build Version
Package Version
No informations.
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 brueggemann/esf contains the following files

Loading the files please wait ....