Download the PHP package zumba/cqrs without Composer

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

Zumba CQRS

Command Query Responsibility Segregation (CQRS) is an established design pattern. This library aims to implement the plumbing needed to create CQRS commands and queries.



Command Bus Usage

The command bus allows commands with handlers to be dispatched with the result being either a Success or Failure.

By design, the command must not return any data.

Creating a command

Creating a command DTO to dispatch to the command bus requires us to extend the abstract Command class.

Creating a command handler

With the MyCommand created from the Creating a command section, we need to handle this command to perform an action.

Tip: The command handler is a great place to introduce any dependencies to be injected.

Dispatching a command

With both a command and handler for that command created, we're ready to dispatch our command to the command bus.

A default batteries-included command bus can be instanced that we can dispatch our command DTOs to the appropriate handlers.


Query Bus Usage

Similar to the command bus, the query bus operates with a query DTO with an accompanying handler dispatched to the query bus in order to get resulting data.

Creating a query

Creating a query DTO to dispatch to the query bus requires us to extend the abstract Query class.

Create a query handler

Query handlers are designed to return a query response depending on the kind of data to return.

In the above created MyQuery DTO, let's assume that this is retrieving a key-value result for a specific entity. We would build our response using the Map response type:

Dispatching a query

As with dispatching a command, we can use the batteries-included query bus which can be included using the QueryBusTrait.

Providers

Providers offer the ability for the command bus to be able to supply a handler for a DTO dispatched to the bus.

zumba\cqrs provides several providers out of the box.

Class Provider

The Zumba\CQRS\Provider\ClassProvider can be used to construct handlers for a DTO via a handler factory. This can be used when the handlers have complex dependencies (ie dependencies that require configuration).

To utilize this, create a handler factory in the same namespace as the DTO. Assume our DTO from the create a command section of MyCommand, the handler factory would look like this:

Method Provider

The Zumba\CQRS\Provider\MethodProvider is similar to the ClassProvider except the handler itself can serve as its own factory.

The MyCommandHandler can be adapted from the create a command handler section:

Simple Dependency Provider

In cases where all dependencies can be instantiated without parameters, the Zumba\CQRS\Provider\SimpleDependencyProvider can be used to construct the handler without the need of a HandlerFactory.

Create a custom provider

To create your own custom provider, implement the Zumba\CQRS\Provider interface and create the bus with the custom provider. You can also provide additional providers to fallback on if your CustomProvider can't accommodate the DTO.


Middleware

The CQRS library is equipped to allow for middleware to be attached to a command or query bus to allow for generic actions to occur for any or all DTOs.

Logger middleware

The logger middleware allows logging all DTOs that are dispatched to through a bus.

Custom middleware

Custom middleware can be included in the MiddlewarePipeline as long as it implements the Middleware interface.

The handle method will accept a DTO and a callable to which to continue the process.

See the Logger middleware as an example.


All versions of cqrs with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
zumba/symbiosis Version ^3.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 zumba/cqrs contains the following files

Loading the files please wait ....