Event Interfaces from Symfony Event Dispatcher Component

dev-master 2016-01-02 00:08 UTC

This package is not auto-updated.

Last update: 2020-03-24 21:17:15 UTC


Standarisation of event for compatibility between all component event implement psr-event

Use interfaces of https://github.com/symfony/EventDispatcher for create standart full.

This repository holds all interfaces/classes/traits related to PSR-3.

Note that this is not a eventDispatcher of its own. It is merely an interface that describes a EventDispatcher, EventSubscriber, EventInterface and GenericEventInterface. See the specification for more details.


If you need a eventDispatcher, you can use the interface like this:


use Psr\Log\EventDispatcherInterface;
use Psr\Log\EventInterface;

class Foo
    private $logger;

    public function __construct(EventDispatcherInterface $logger = null)
        $this->eventDispatcher = $eventDispatcher;

    public function doSomething()
        if ($this->eventDispatcher) {
            $this->eventDispatcher->addListener('event_name', function (EventInterface $event) {
                // ...


        // do something useful

You can then pick one of the implementations of the interface to get a logger.

If you want to implement the interface, you can require this package and implement Psr\Log\EventDispatcherInterface in your code. Please read the specification text for details.