2017 © Pedro Peláez
 

typo3-flow-package flow-eventbroker

TYPO3 Flow package containing an event dispatching mechanism

image

helmich/flow-eventbroker

TYPO3 Flow package containing an event dispatching mechanism

  • Wednesday, October 1, 2014
  • by helmich
  • Repository
  • 3 Watchers
  • 1 Stars
  • 19 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Event Broker

A simple event dispatching library for TYPO3 Flow., (*1)

Installation

The package is available on Packagist. Use the following setup in your composer manifest:, (*2)

{
    "require": {
        "helmich/flow-eventbroker": "*"
    }
}

Examples

Publishing events

Events are regular methods that are tagged with an @Event\Event annotation:, (*3)

<?php
namespace My\Example;

use Helmich\EventBroker\Annotations as Event;

class Emitter {
    public function doSomething() {
        // ...
        $this->publishSomeEvent(new SomeEvent("foo"));
    }

    /**
     * @Event\Event
     */
    protected function publishSomeEvent(SomeEvent $event) {

    }
}

Subscribing to events

Listeners are also regular methods, that are tagged with an @Event\Listener annotation. The event class to listen for is specified as parameter within the annotation., (*4)

<?php
namespace My\Example;

use Helmich\EventBroker\Annotations as Event;

class Listener {
    /**
     * @Event\Listener("My\Example\SomeEvent")
     */
    public function myListener(SomeEvent $event) {

    }
}

Synchronous and asynchronous events

By defaults, listeners will be called asynchronously. In the default implementation, events will be queued and dispatched in an event loop at the end of the main application run (other, later implementations might do this completely asynchronously by dispatching events to another process)., (*5)

You can explicitly declare listeners to be processed synchronously (when the event is published) by using the "sync" tag in the @Event\Listener annotation:, (*6)

<?php
namespace My\Example;

use Helmich\EventBroker\Annotations as Event;

class Listener {

    /**
     * @Event\Listener("My\Example\SomeEvent", sync=TRUE)
     */
    public function myListener(SomeEvent $event) { }
}

To-Do

  • Add unit test coverage
  • Provide mechanisms for asynchronous event processing

The Versions

01/10 2014

dev-master

9999999-dev

TYPO3 Flow package containing an event dispatching mechanism

  Sources   Download

MIT

The Requires

 

01/10 2014

v1.1.0

1.1.0.0

TYPO3 Flow package containing an event dispatching mechanism

  Sources   Download

MIT

The Requires

 

01/10 2014

dev-feature-sync-dispatching

dev-feature-sync-dispatching

TYPO3 Flow package containing an event dispatching mechanism

  Sources   Download

MIT

The Requires

 

28/09 2014

v1.0.1

1.0.1.0

TYPO3 Flow package containing an event dispatching mechanism

  Sources   Download

MIT

The Requires

 

28/09 2014

v1.0.0

1.0.0.0

TYPO3 Flow package containing an event dispatching mechanism

  Sources   Download

MIT

The Requires