2017 © Pedro PelĂĄez
 

library laravel-commandbus

DeSmart CommandBus for Laravel

image

desmart/laravel-commandbus

DeSmart CommandBus for Laravel

  • Wednesday, February 3, 2016
  • by DeSmart
  • Repository
  • 4 Watchers
  • 0 Stars
  • 3,249 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Laravel CommandBus

A small, pluggable command bus., (*1)

Instalation

  1. $ composer require desmart/laravel-commandbus
  2. Add DeSmart\CommandBus\ServiceProvider to app.php

Example usage:

Command Class

class RegisterUserCommand
{
    protected $email;

    public function __construct($email)
    {
        $this->email = $email;
    }

    public function getEmail()
    {
        return $this->email;
    }
}

CommandValidator Class

class RegisterUserCommandValidator
{
    public function validate(RegisterUserCommand $command)
    {
        // it will be called before handler
    }
}

CommandHandler Class

class RegisterUserCommandHandler
{
    public function handle(RegisterUserCommand $command)
    {
        // it will be called if validator won't throw any exception
    }
}

Execute the command:

class Controller
{
    /**
     * @var \DeSmart\CommandBus\Contracts\CommandBus
     */
    protected $commandBus;

    public function __construct(\DeSmart\CommandBus\Contracts\CommandBus $commandBus)
    {
        $this->commandBus = $commandBus;
    }

    public function index()
    {
        $command = new RegisterUserCommand("foo@bar.net");
        $this->commandBus->handle($command);
    }
}

The Versions

03/02 2016

dev-master

9999999-dev

DeSmart CommandBus for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by MichaƂ Golon

03/02 2016

1.1.0

1.1.0.0

DeSmart CommandBus for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by MichaƂ Golon

01/07 2015

1.0.1

1.0.1.0

DeSmart CommandBus for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by MichaƂ Golom

01/07 2015

1.0.0

1.0.0.0

DeSmart CommandBus for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by MichaƂ Golom