Giter Club home page Giter Club logo

cqrs-module's Introduction

CQRS Module for Zend Framework 2

Build Status

CQRSModule integrates CQRS library with Zend Framework 2 quickly and easily.

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

Install the module via command:

php composer.phar require pauci/cqrs-module
# (When asked for a version, type `dev-master`)

Then add CQRSModule to your config/application.config.php

Setup

return [
    'cqrs' => [
        'commandHandlerLocator' => [
            'cqrs_default' => [
                'handlers' => [
                    'UserService' => [
                        'ChangeUserName'
                    ]
                ]
            ]
        ],
        'eventHandlerLocator' => [
            'cqrs_default' => [
                'services' => [
                    'EchoEventListener' => [
                        'UserNameChanged'
                    ]
                ]
            ]
        ]
    ]
];

Registered Service names

  • cqrs.command_bus.cqrs_default: a CQRS\CommandHandling\CommandBusInterface instance
  • cqrs.command_handler_locator.cqrs_default: a CQRS\CommandHandling\Locator\CommandHandlerLocatorInterface instance
  • cqrs.transaction_manager.cqrs_default: a CQRS\CommandHandling\TransactionManager\TransactionManagerInterface instance
  • cqrs.event_publisher.cqrs_default: the CQRS\EventHandling\Publisher\EventPublisherInterface instance
  • cqrs.event_bus.cqrs_default: the CQRS\EventHandling\EventBusInterface instance
  • cqrs.event_handler_locator.cqrs_default: the CQRS\EventHandling\Locator\EventHandlerLocatorInterface instance
  • cqrs.event_store.cqrs_default: the CQRS\EventStore\EventStoreInterface instance
  • cqrs.serializer.reflection: the CQRS\Serializer\ReflectionSerializer instance

Service Locator

To access the entity manager, use the main service locator:

// for example, in a controller:
$commandBus          = $this->getServiceLocator()->get('cqrs.command_bus.cqrs_default');
$eventHandlerLocator = $this->getServiceLocator()->get('cqrs.event_handler_locator.cqrs_default');

cqrs-module's People

Contributors

pauci avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.