2017 © Pedro Peláez
 

library nette-cqrs-commands

Simple CQRS Commands for Nette Framework

image

adamstipak/nette-cqrs-commands

Simple CQRS Commands for Nette Framework

  • Saturday, January 10, 2015
  • by newPOPE
  • Repository
  • 2 Watchers
  • 3 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Simple CQRS Commands for Nette Framework

Connect Commands with services in Nette.

This extension provide a simle implementation of CQRS commands., (*1)

Build Status, (*2)

Installation:

The best way to install Nette-CQRS-Commands is using Composer:, (*3)

$ composer require adamstipak/nette-cqrs-commands

Usage:

Example of Command:, (*4)

use SimpleBus\Command\Command;

class FooCommand implements Command {

  public function __construct(...) {
    // your code
  }

  /**
   * @return string
   */
  public function name() {
    return 'foo'; // identificator of command
  }
}

Example of CommandHandler:, (*5)

use SimpleBus\Command\Command;
use SimpleBus\Command\Handler\CommandHandler;

class FooCommandHandler implements CommandHandler {

  /**
   * @param FooCommand $command
   */
  public function handle(Command $command) {
    // $command is instance of FooCommand
  }
}

Register all things in config.neon., (*6)

services:
  fooCommandHandler: FooCommandHandler # your service

extensions:
  events: AdamStipak\Commands\DI\CommandsExtension

commands:
  # mapping commands to handlers
  handlers:
    foo: @fooCommandHandler

  # configuration (here is default values so you can avoid this lines)
  commandResolver: \AdamStipak\Commands\Command\DefaultCommandResolver
  handlerResolver: \AdamStipak\Commands\Handler\DefaultHandlerResolver
  bus: \AdamStipak\Commands\Bus\DefaultBus

Example of Presenter:, (*7)

class FooPresenter extends Nette\Application\UI\Presenter {

  /**
   * @var AdamStipak\Commands\Bus\DefaultBus
   * @inject
   */
  public $commands;

  public function actionBar() {

    // ... your code here ...

    $this->commands->handle(new FooCommand(...)); // send the command to command bus (model)
  }

}

The Versions

10/01 2015

dev-master

9999999-dev https://github.com/newPOPE/Nette-RestRoute

Simple CQRS Commands for Nette Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

commands nette cqrs

10/01 2015

1.0.0

1.0.0.0 https://github.com/newPOPE/Nette-RestRoute

Simple CQRS Commands for Nette Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

commands nette cqrs