Download the PHP package itantik/cq-dispatcher without Composer

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

CQ Dispatcher

Command Query Dispatcher with middleware support. This library can have its place in applications that are designed according to the principles of Command Query Separation (CQS) or Command Query Responsibility Segregation (CQRS).

CQ Dispatcher is typically located in the application service layer, its clients are controllers and presenters from UI layer. It dispatches application requests, these are commands and queries, finds an appropriate handler and executes it.

Command represents a request, that performs an action through a command handler. It modifies data or changes the state of objects. It doesn't return a value.

Query represents a request, that gets a data through a query handler. It must not modify data. It returns a value.

Installation

Usage

CQ Dispatcher requires a dependency injection container. You have to define an adapter to your DI container. Adapter implements Itantik\CQDispatcher\DI\IContainer.

Usage with Nette framework

Install itantik/nette-cq-dispatcher extension for Nette framework. It is configured to use Nette DI Container.

Example of file structure

Assume that the application service layer has the following file structure:

Command

Command is a plain object that implements Itantik\Middleware\IRequest interface and class name uses optional Command suffix. The command object represents your request.

Command Handler

Command handler implements Itantik\CQDispatcher\Command\ICommandHandler interface and class name should use Handler suffix. Command handler represents an application service.

Command Dispatcher

Command dispatcher creates an appropriate command handler based on the command class name, then invokes its handle method. For each command, there is a single command handler.

By default, pairing command with its handler is based on class names.

Command Namespace\SomeCommand uses Namespace\SomeHandler handler. Command suffix is optional, so you can name command as Namespace\Some instead of Namespace\SomeCommand.

Creating Command Dispatcher

Command dispatcher extends abstract class \Itantik\CQDispatcher\Commands.

Using in Controllers and Presenters

Extending with Middleware

Command dispatcher has built-in itantik/middleware support.

For example, middleware for wrapping each command handler with a database transaction can look like this:

Extending command dispatcher:

Using in controller is not changed. Now each command is executed in database transaction.

Query

Query implements Itantik\Middleware\IRequest interface and class name uses optional Query suffix.

Query Handler

Query handler implements Itantik\CQDispatcher\Query\IQueryHandler interface, class name should use Handler suffix, handle method returns a value.

Query Dispatcher

Similar to the command dispatcher.

Query Namespace\SomeQuery uses Namespace\SomeHandler handler. Query suffix is optional, so you can name query as Namespace\Some instead of Namespace\SomeQuery.

Creating Query Dispatcher

Query dispatcher extends abstract class \Itantik\CQDispatcher\Queries.

Using in Controllers and Presenters

Extending with Middleware

The same as with the Command dispatcher.

Requirements


All versions of cq-dispatcher with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.2
itantik/middleware Version ^0.2
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 itantik/cq-dispatcher contains the following files

Loading the files please wait ....