Statistics
3276
2
0
287d
Badges
Dependencies

nette-events-extension

Really simple events dispatcher for Nette Framework.

Usage:

add this to your config.neon

extensions:
	- Bazo\Events\DI\EventsExtension

services:
	- {class: Listener1, tags: [subscriber]}
	- {class: Listener2, tags: [subscriber]}
	...

A subscriber must implement getSubscribedEvents static function from Bazo\Events\Subscriber interface

class Listener1 implements Bazo\Events\Subscriber
{
	public static function getSubscribedEvents()
	{
		return [
			'event1' => [
				'callback1',
				'callback2',
			],
			'event2' => [
				'callback3',
				'callback4',
			]
		];
	}

	public function callback1($arg1, $arg2, ...) {...}
}

Callbacks are function names.

Then you dispatch an event like this:

$args = [
	$arg1,
	$arg2
];
$dispatcher->dispatchEvent('event1', $args);

No release at this moment. Try to create first one.

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com