PHPackages                             baagee/php-event - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. baagee/php-event

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

baagee/php-event
================

PHP event library

v0.0.1(7y ago)1431MITPHPPHP &gt;=7.1

Since Mar 25Pushed 7y agoCompare

[ Source](https://github.com/baagee/php-event)[ Packagist](https://packagist.org/packages/baagee/php-event)[ RSS](/packages/baagee-php-event/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

php-event
=========

[](#php-event)

PHP Event Library

### php事件定义与触发

[](#php事件定义与触发)

### 安装

[](#安装)

composer require baagee/php-event

### 使用示例：

[](#使用示例)

```
include_once __DIR__ . '/../vendor/autoload.php';

// 匿名函数 不传参数
// 重复事件
\BaAGee\Event\Event::listen('event1', function () {
    echo 'event1' . PHP_EOL;
    return 'return event1';
});
// 第三个参数为true 一次性事件 触发后就删除，下次就不会再次触发了
\BaAGee\Event\Event::listen('event1', function () {
    echo 'once event1' . PHP_EOL;
    return 'return once event1';
}, true);
// 触发event1事件
$res = \BaAGee\Event\Event::trigger('event1');
var_dump($res);
$res = \BaAGee\Event\Event::trigger('event1');
var_dump($res);
```

输出结果：

```
event1
once event1
/Users/baagee/PhpstormProjects/github/php-event/tests/test1.php:23:
array(2) {
  [0] =>
  string(13) "return event1"
  [1] =>
  string(18) "return once event1"
}
event1
/Users/baagee/PhpstormProjects/github/php-event/tests/test1.php:25:
array(1) {
  [0] =>
  string(13) "return event1"
}

```

### 详细示例代码：tests目录

[](#详细示例代码tests目录)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2607d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22995500?v=4)[BaAGee](/maintainers/baagee)[@baagee](https://github.com/baagee)

---

Top Contributors

[![baagee](https://avatars.githubusercontent.com/u/22995500?v=4)](https://github.com/baagee "baagee (2 commits)")

---

Tags

phpevent

### Embed Badge

![Health badge](/badges/baagee-php-event/health.svg)

```
[![Health](https://phpackages.com/badges/baagee-php-event/health.svg)](https://phpackages.com/packages/baagee-php-event)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
