Simple event management.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.editorconfig
.gitattributes
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
build.xml
composer.json
phpunit.xml

README.md

Trigger

Latest Version Build Status Software License

Simple event management for PHP 7.

System Requirements

PHP 7.0 or later.

Install

Install using Composer:

$ composer require maximegosselin/trigger

Trigger is registered under the MaximeGosselin\Trigger namespace.

Usage

$manager = new EventManager();

Listen for a named event:

$manager->on('login.success', function($event) { /*...*/ });

Listen for all events that match a regular expression:

$manager->on('/^login\./', function($event) { /*...*/ });

Trigger an event with parameters:

$manager->trigger('login.success', [
    'username' => 'jsmith'
]);

Tests

Run the following command from the project folder.

$ vendor/bin/phpunit

License

The MIT License (MIT). Please see LICENSE for more information.