ilya-dev / head

Head is a micro event dispatcher for PHP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Head

Head is a micro event dispatcher for PHP.

Use

Create

$head = new \Head\Head;

// or

class MyOwnHead implements \Head\Contract {

    use \Head\Behaviour;

    // do what you want

}

Attach

$head->listen('foo', function($foo, $bar, $baz)
{
    // do something
});

// also valid:
// $head->listen('foo', 'valid_function');
// $head->listen('foo', ['SomeClass', 'someMethod');
// $head->listen('foo', [new SomeClass, 'someMethod']);
// and so on...

Fire

$head->fire('my_epic_event', ['pass', 'the', 'context']);

License

Head is licensed under the MIT license.

About

Head is a micro event dispatcher for PHP.

License:MIT License


Languages

Language:PHP 100.0%