定制 helmich/flow-eventbroker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

helmich/flow-eventbroker

Composer 安装命令:

composer require helmich/flow-eventbroker

包简介

TYPO3 Flow package containing an event dispatching mechanism

README 文档

README

A simple event dispatching library for TYPO3 Flow.

Installation

The package is available on Packagist. Use the following setup in your composer manifest:

{
    "require": {
        "helmich/flow-eventbroker": "*"
    }
}

Examples

Publishing events

Events are regular methods that are tagged with an @Event\Event annotation:

<?php
namespace My\Example;

use Helmich\EventBroker\Annotations as Event;

class Emitter {
    public function doSomething() {
        // ...
        $this->publishSomeEvent(new SomeEvent("foo"));
    }

    /**
     * @Event\Event
     */
    protected function publishSomeEvent(SomeEvent $event) {

    }
}

Subscribing to events

Listeners are also regular methods, that are tagged with an @Event\Listener annotation. The event class to listen for is specified as parameter within the annotation.

<?php
namespace My\Example;

use Helmich\EventBroker\Annotations as Event;

class Listener {
    /**
     * @Event\Listener("My\Example\SomeEvent")
     */
    public function myListener(SomeEvent $event) {

    }
}

Synchronous and asynchronous events

By defaults, listeners will be called asynchronously. In the default implementation, events will be queued and dispatched in an event loop at the end of the main application run (other, later implementations might do this completely asynchronously by dispatching events to another process).

You can explicitly declare listeners to be processed synchronously (when the event is published) by using the "sync" tag in the @Event\Listener annotation:

<?php
namespace My\Example;

use Helmich\EventBroker\Annotations as Event;

class Listener {

    /**
     * @Event\Listener("My\Example\SomeEvent", sync=TRUE)
     */
    public function myListener(SomeEvent $event) { }
}

To-Do

  • Add unit test coverage
  • Provide mechanisms for asynchronous event processing

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-09-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固