Download the PHP package ignislabs/flare-cqrs without Composer

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

Flare CQRS

Flare is a small and easy to use CQRS library.
It drives CQRS by making use of the message bus pattern, separating Queries (interrogatory messages) from Commands (imperative messages).

This library was greatly inspired by Messaging Flavours article by Mathias Verraes.

What is CQRS?

Originated with Bertrand Meyer's Command and Query Separation principle (CQS):

It states that every method should either be a command that performs an action, or a query that returns data to the caller, but not both. In other words, asking a question should not change the answer. More formally, methods should return a value only if they are referentially transparent and hence possess no side effects.

So, Command and Query Responsibility Segregation (CQRS):

... applies the CQS principle by using separate Query and Command objects to retrieve and modify data, respectively.

Source: Wikipedia

Installation

Through composer:

Usage

FlareCQRS is framework-agnostic, but it's really easy to bootstrap and use.

Bootstrapping

Usage

Now you can use the buses to dispatch any message, like so:

Message (Query & Command) classes

Your Message classes are simple DTO objects, so there are no rules or contracts to use, they can be whatever you like.

You can, however, take advantage of the DataAccessorTrait. With it you can have automatic accessor properties for your message classes. The trait defines a data private property, a get accessor method and the __get magic method so you can access the data as properties:

Handlers

A handler can be anything, as long as it is callable. Although, you will probably want to make them classes. In order to make a class be callable, just implement the __invoke method in it.

The __invoke method will receive an instance of the corresponding command.

This way, the classes are 100% yours, no hard dependency on this library whatsoever and you can typehint freely.

Let's see a quick example:

Middlewares

You can create middlewares to interact with the messages before they reach their respective handlers.

Middlewares, same as with the Handlers, are callables, but you might prefer them to be classes, by using the same __invoke strategy.

You can pass your middlewares globally to your buses on instantiation as the last parameters like so:

Or you can add/replace the middlewares on a one time basis:

Buses are immutable, so adding or replacing middlewares on a bus will always return a new bus instance, so any subsequent calls to your buses will not be affected by these middleware changes.


All versions of flare-cqrs with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 ignislabs/flare-cqrs contains the following files

Loading the files please wait ....