library events
events php library
g4/events
events php library
- Monday, February 9, 2015
- by g4code
- Repository
- 4 Watchers
- 1 Stars
- 3,811 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 3 Versions
- 14 % Grown
events
events - php library, (*1)
Install
Via Composer, (*2)
composer require g4/events
Usage
// Register event as an anonymous function
\G4\Events\PubSub::on('event_name', function($arg1, $arg2) { echo $arg1; echo $arg2; });
// Register event as a class method
\G4\Events\PubSub::on('event_name', [new \G4\Events\Test(), 'test']);
// Unregister all subscribers
\G4\Events\PubSub::clear();
// Unregister all subscribers based on event name
\G4\Events\PubSub::off('event_name');
// Unregister one single subscriber
\G4\Events\PubSub::off('event_name', [new \G4\Events\Test(), 'test']);
// Get all events and subscribers
\G4\Events\PubSub::getEvents();
// Check if event is registered
\G4\Events\PubSub::has('event_name');
// Check if subscriber is registered
\G4\Events\PubSub::has('event_name', [new \G4\Events\Test(), 'test']);
// Trigger event with arguments
\G4\Events\PubSub::trigger('event_name', [12345, 987]);
// Trigger event without arguments
\G4\Events\PubSub::trigger('event_name');
Development
Install dependencies
$ make install
Run tests
$ make test
License
(The MIT License)
see LICENSE file for details..., (*3)
dev-master
9999999-dev
events php library
Sources
Download
MIT
The Requires
The Development Requires
by
Drasko Gomboc
by
Dejan Samardzija
by
Ivan Krickovic
events
subscriber
pubsub
publisher
dev-develop
dev-develop
events php library
Sources
Download
MIT
The Requires
The Development Requires
by
Drasko Gomboc
by
Dejan Samardzija
by
Ivan Krickovic
events
subscriber
pubsub
publisher
0.1.0
0.1.0.0
events php library
Sources
Download
MIT
The Requires
The Development Requires
by
Drasko Gomboc
by
Dejan Samardzija
by
Ivan Krickovic
events
subscriber
pubsub
publisher