bephp / observable
A observable trait
v0.1
2016-04-15 15:02 UTC
Requires
- php: >=5.4.0
Requires (Dev)
This package is not auto-updated.
Last update: 2024-11-01 19:27:38 UTC
README
A observable triat for PHP.
Installation
composer require bephp/observable
API Reference
on($event, $cb)
add event
off($event)
remove event
trigger()
trigger event
Example
class A{
use Observable;
}
$a = new A();
$a->on('hello', function($name){
echo 'hello ', $name, '!';
});
$a->trigger('hello', 'lloyd');
this demo will get result:
hello lloyd!