PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of carlos carvalho   Observable PHP Event Listener and Emitter   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Observable PHP Event Listener and Emitter
Listen and emit events handled by callbacks
Author: By
Last change:
Date: 4 years ago
Size: 274 bytes
 

Contents

Class file image Download
<?php

require_once __DIR__ . '/vendor/autoload.php';
$emitter = \COC\Event\Emitter::getInstance();

$emitter->on('evm.createdUser', function($name, $lastname){
    print(
"hello {$lastname}, {$name} welcome!!");
});

$emitter->emit('evm.createdUser','Carlos','Carvalho');