PHP code example of logikostech / events

1. Go to this page and download the library: Download logikostech/events 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/ */

    

logikostech / events example snippets


class foo implements \Phalcon\Events\EventsAwareInterface {
  use \Logikos\Events\EventsAwareTrait;
}

$component->attachEventListener(null, function(\Phalcon\Events\Event $event, $component, $data=null) {
  switch ($event->getType()) {
    case 'beforeAction' :
      // ...
      break;
    case 'afterAction' :
      // ...
      break;
  }
});

$component->attachEventListener('beforeAction', function(\Phalcon\Events\Event $event, $component, $data=null) {
  // ...
});