ehough/tickertape

兼容 PHP 5.2+ 的 Symfony 事件分发器的分支。

此包的官方仓库似乎已不存在,因此该包已被冻结。

v2.5.4 2014-09-24 18:32 UTC

This package is not auto-updated.

Last update: 2019-03-01 00:14:40 UTC


README

Build Status Project Status: Unsupported - The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired. Latest Stable Version License

此库不再受支持或维护,因为 PHP 5.2 的使用率最终已降至 10% 以下。

兼容 PHP 5.2+ 的 Symfony 事件分发器组件的分支。

动机

Symfony 的 事件分发器组件是一个非常棒的库,但它只兼容 PHP 5.3+。虽然 97% 的 PHP 服务器运行 PHP 5.2 或更高版本,但 32% 的所有服务器仍在运行 PHP 5.2 或更低版本 (来源)。仅仅因为几个版本不兼容就排除这个库,让近一半的全球服务器无法使用它,真是太可惜了。

Symfony 的事件分发器组件的不同之处

主要区别在于 Symfony 类的命名约定。在 \Symfony\Component\EventDispatcher 命名空间(及其子命名空间)中,使用 ehough_tickertape 前缀来命名 Symfony 类,并遵循 PEAR 命名约定

一些类命名转换的示例

\Symfony\Component\EventDispatcher\EventDispatcher   ----->    ehough_tickertape_EventDispatcher
\Symfony\Component\EventDispatcher\Event             ----->    ehough_tickertape_Event

使用

$dispatcher = new ehough_tickertape_EventDispatcher();  //implements ehough_tickertape_EventDispatcherInterface

$dispatcher->addListener('event_name', $callback);

$dispatcher->dispatch('event_name');

版本和版本控制

版本与上游 Symfony 仓库同步。例如,ehough/tickertape v2.3.1 合并了来自 symfony/EventDispatcher v2.3.1 的代码。