Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 1.19 KB

README.md

File metadata and controls

43 lines (28 loc) · 1.19 KB

observable

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License

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!