2017 © Pedro Peláez
 

library events

Events helper for phalcon php projects

image

logikostech/events

Events helper for phalcon php projects

  • Saturday, April 8, 2017
  • by logikos
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Travis CI Software License, (*1)

Logikos\Events\EventsAwareTrait

Useful trait when using Phalcon\Events\EventsAwareInterface. Key feature is the attachEventListener method in that if an EventsManager is not yet being used by the component it will add one and then attach the event. This way you don't have to setup your events manager when you setup the \Phalcon\Di services and each controller or library using the componenet can attach their own events as they see fit on a case by case basis., (*2)

Usage

Add to class

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

Add event handelers with ease

To listen for all events pass null

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

Listen for specific event

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

The Versions

08/04 2017

dev-master

9999999-dev https://github.com/logikostech/events

Events helper for phalcon php projects

  Sources   Download

MIT

The Requires

  • php >=5.6
  • ext-phalcon >=2.0

 

The Development Requires

by Todd Empcke

08/04 2017

v1.0.0

1.0.0.0 https://github.com/logikostech/events

Events helper for phalcon php projects

  Sources   Download

MIT

The Requires

  • php >=5.6
  • ext-phalcon >=2.0

 

The Development Requires

by Todd Empcke