Skip to content

bephp/observable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!