PHP code example of flextype-components / event

1. Go to this page and download the library: Download flextype-components/event library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flextype-components / event example snippets


use Flextype\Component\Event\Event;

Event::addListener('event_name', function() { echo 'Test Event 1'; }, 1);
Event::addListener('event_name', function() { echo 'Test Event 2'; }, 2);

Event::removeAllListeners('event_name');

if (Event::hasListeners('event_name')) {
    // do something...
}

Event::dispatch('event_name');

$listeners = Event::getListeners();