Events

Component based event handling

Declare methods in your components to handle events by prefixing the event name with onEmit (or onEmit_) & using unserscores (_) instead of periods (.). Example:

class RequestLogger extends \Lia\Compo {  
	public functon onEmitResponseSent($responseOutput){  
	    file_put_contents(__DIR__.'/log.txt', 'Response sent at '.microtime(true), FILE_APPEND|LOCK_EX);  
	}  
}  

This function would be called for $lia->emit('ResponseSent') event.

Create/Emit an event

Just call $lia->emit('nameOfEvent', $param1, $param2, ...$etc)

Functional event handling

Call $lia->schedule('Namespace.nameOfEvent', $callable). Then $callable will be invoked whenever Namespace.nameOfEvent is emitted.

Available Events

  • We haven't documented this yet...