logikostech/events 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

logikostech/events

Composer 安装命令:

composer require logikostech/events

包简介

Events helper for phalcon php projects

README 文档

README

Travis CI Software License

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.

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) {
  // ...
});

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-09