Download the PHP package arkonsoft/ps-module-cqrs without Composer

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

PS Module CQRS

A lightweight CQRS (Command Query Responsibility Segregation) implementation for PrestaShop modules. Uses PHP 8 attributes to bind commands and queries to their handlers — no registry or convention-based resolution.

Table of Contents

Description

This library provides a simple way to implement the CQRS pattern in PrestaShop modules. It includes CommandBus and QueryBus classes that resolve handlers at runtime by reading the #[HandledBy(HandlerClass::class)] attribute from the command or query class. There is no registry, no builder, and no naming convention — you pass a callable that creates handler instances (e.g. from your DI container or new $class()).

Requirements

The library does not require any specific DI container. You provide a callable that resolves handler class names to instances.

Installation

Usage

Basic Setup

In your module's main class, create the buses by passing a callable that receives the handler class name (string) and returns the handler instance:

The HandledBy Attribute

Put the HandledBy attribute on the command or query class (not on the handler). It points to the handler class that will process that command or query.

The bus reads this attribute at runtime when you call handle(), so there is no registry to build or namespaces to scan.

Creating Commands and Handlers

Command — add the attribute with the handler class:

Handler — no attribute; just implement handle(Command $command):

Creating Queries and Handlers

Query — add the attribute with the handler class:

Handler — no attribute; just implement handle(Query $query):

Using the Buses

Handler Resolution (callable)

The constructor of CommandBus and QueryBus accepts a callable with signature (string $handlerClass): object. The bus calls it with the handler FQCN (from the HandledBy attribute) and uses the returned instance to call handle($command) or handle($query).

Examples:

With a PSR-11 or custom container:

Simple factory (no DI):

There is no HandlerResolverInterface or resolver class in the library — you pass the callable directly.

Error Handling

Migration from Convention-Based Binding

If you used an older version that resolved handlers by convention (e.g. CreateProductCommand → CreateProductHandler in a Handler namespace):

  1. Add #[HandledBy(YourHandler::class)] to each command and query class.
  2. Replace the container in the bus constructor with a callable:
    new CommandBus(fn(string $class) => $container->get($class))
    (and the same for QueryBus).
  3. Remove any dependency on a specific DI library from this package; your module still uses its own container inside the callable.

No registry, builder, or handler list is required.

License

Commercial - The terms of the license are subject to a proprietary agreement between the author (Arkonsoft) and the licensee.

Support

For support and questions, please contact: [email protected]


All versions of ps-module-cqrs with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 arkonsoft/ps-module-cqrs contains the following files

Loading the files please wait ...