2017 © Pedro Peláez
 

library async-event-dispatcher

An asynchronous event dispatcher for symfony

image

solilokiam/async-event-dispatcher

An asynchronous event dispatcher for symfony

  • Sunday, November 16, 2014
  • by solilokiam
  • Repository
  • 2 Watchers
  • 2 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

AsyncEventDispatcher Component

Build Status SensioLabsInsight Dependency Status Scrutinizer Code Quality, (*1)

This component is an async event dispatcher based on the Symfony's event dispatcher component but in a fire and forget way. Right now it needs Redis to work but if you use another queue system it's really easy to extend and use., (*2)

Warning

This code is not ready for production. This is still a Work in progress, things may change a lot over time., (*3)

Installation

Using composer

Add following lines to your composer.json file:, (*4)

"require": {
      ...
      "solilokiam/async-event-dispatcher": "dev-master"
    },

How do you dispatch events?

If you've already used symfony event dispatcher it's really simple to use. First you need to create your own event. This event must extend AsyncEvent . Once you've got your event created you need to dispatch it using the AsyncEventDispatcher. You need to inject an object that implements EventDriverInterface when you instantiate the AsyncEventDispatcher class. This component provides you with a RabbitMq implementation of the interface. Feel free to create your own if you need it., (*5)

In the following example you can see how to do it:, (*6)

namespace Foo\Events;

use Solilokiam\AsyncEventDispatcher\AsyncEvent;

class FooAsyncEvent extends AsyncEvent
{
    protected $foo;

    public function setFoo($value)
    {
        $this->foo = $value;

        return $this;
    }

    public function getFoo()
    {
        return $this->foo;
    }
}
$redirEventDriver = new RedisDriver($redisConfig);

$asyncEventDispatcher = new AsyncEventDispatcher($redisEventDriver);

$fooEvent = new FooAsyncEvent();
$fooEvent->setFoo('whatever');

$dispatcher->dispatch('foo.event', $fooEvent);

How do you define event listeners?

TODO, (*7)

How do you consume dispatcher events?

TODO, (*8)

License

AsyncEventDispatcher is licensed under the MIT License. See the LICENSE file for full details., (*9)

The Versions

25/10 2014

dev-update-package-dependencies

dev-update-package-dependencies

An asynchronous event dispatcher for symfony

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miquel Company Rodriguez