2017 © Pedro Peláez
 

library dispatcher

Dispatcher library

image

halimonalexander/dispatcher

Dispatcher library

  • Wednesday, June 6, 2018
  • by halimonalexander
  • Repository
  • 0 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 400 % Grown

The README.md

Dispatcher

Events dispatcher Library, (*1)

main branch parameter, (*2)

Install

$ composer require halimonalexander/dispatcher

Example of usage

use HalimonAlexander\Dispatcher\Dispatcher;
use HalimonAlexander\Dispatcher\Event;
use HalimonAlexander\Dispatcher\Listener;

class FooBarEvent extends Event
{
    public const EVENT_NAME = 'FooBar';

    public function foo(): void
    {
        //...
    }

    public function bar(): void
    {
        //...
    }
}

class FooListener extends Listener
{
    public function __invoke(Event $event) : void
    {
        if ($event instanceof FooBarEvent) {
            $event->foo();
        }
    }
}

class BarListener extends Listener
{
    public function __invoke(Event $event) : void
    {
        if ($event instanceof FooBarEvent) {
            $event->bar();
        }
    }
}

$dispatcher = new Dispatcher();
$dispatcher->addListener(FooBarEvent::EVENT_NAME, new FooListener());
$dispatcher->addListener(FooBarEvent::EVENT_NAME, new BarListener());
// ...
$dispatcher->dispatch(FooBarEvent::EVENT_NAME, new FooBarEvent());

The Versions

06/06 2018

dev-master

9999999-dev https://github.com/halimonalexander/dispatcher

Dispatcher library

  Sources   Download

BSD-3-Clause

The Requires

  • php ^7.2

 

by Halimon Alexander

06/06 2018

v1.2.1

1.2.1.0 https://github.com/halimonalexander/dispatcher

Dispatcher library

  Sources   Download

BSD-3-Clause

The Requires

  • php ^7.1

 

by Halimon Alexander

20/05 2018

v1.2

1.2.0.0 https://github.com/halimonalexander/dispatcher

Dispatcher library

  Sources   Download

BSD-3-Clause

The Requires

  • php ^7.1

 

by Halimon Alexander

20/05 2018

v1.1

1.1.0.0 https://github.com/halimonalexander/dispatcher

Dispatcher library

  Sources   Download

BSD-3-Clause

The Requires

  • php ^7.1

 

by Halimon Alexander

20/05 2018

v1.0

1.0.0.0 https://github.com/halimonalexander/dispatcher

Dispatcher library

  Sources   Download

BSD-3-Clause

The Requires

  • php ^7.1

 

by Halimon Alexander