PHPackages                             qiyunhai/webman-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. qiyunhai/webman-event

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

qiyunhai/webman-event
=====================

Webman plugin qiyunhai/webman-event

v1.0.0(3y ago)05MITPHPPHP &gt;=7.1.0

Since Dec 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/qiyunhai/webman-event)[ Packagist](https://packagist.org/packages/qiyunhai/webman-event)[ RSS](/packages/qiyunhai-webman-event/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

通过观察者模式开发的webman框架简易版事件扩展包； 通常用于用户注册后的一系列操作，可在不更改原有代码的同时添加额外的扩展功能，降低耦合性。

此事件额外还开发了生成事件的命令行功能。

安装
--

[](#安装)

```
composer require qiyunhai/webman-event
```

### 配置

[](#配置)

事件默认配置文件 `config/plugin/qiyunhai/event/event.php`

```
return [
    // 此处可替换为 app\events\Test::class
    'app\events\Test' => [
        'app\listeners\test\ObServer1',
        'app\listeners\test\ObServer2',
    ],
];
```

`注意：配置文件也可以放在其他地方，只需更改触发事件的event方法即可`

命令行生成事件 `-l` 检查配置文件里不存在的事件进行创建操作 `-c` 事件的配置文件，下面示例的配置文件为`config/event.php`

```
php webman qiyunhai:event -c event -l
```

### 快速开始

[](#快速开始)

事件类 `app\events\Test`

```
namespace app\events;

class Test
{
    public $id;

    public function __construct($id = null)
    {
        $this->id = $id;
    }
}
```

监听类1 `app\listeners\test\ObServer1`

```
namespace app\listeners\test;

use app\events\Test;

class ObServer1
{
    public function run(Test $event)
    {
        $res = 'ObServer 1, id:'.$event->id;
        $event->id = 2;

        return $res;
    }
}
```

监听类2 `app\listeners\test\ObServer2`

```
namespace app\listeners\test;

use app\events\Test;

class ObServer2
{
    public function run(Test $event)
    {
        return 'ObServer 2, id:'.$event->id;
    }
}
```

### 触发事件

[](#触发事件)

```
event(new (app\events\Test(1)));
```

### 执行结果

[](#执行结果)

```
array(
    [0] => "ObServer 1, id:1",
    [1] => "ObServer 2, id:2"
)

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

1250d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aa04dd2ee1fc2deb96bb6e9109e42043550cb8693b32447727e3a9fb31b3a5c0?d=identicon)[qiyunhai](/maintainers/qiyunhai)

---

Top Contributors

[![qiyunhai](https://avatars.githubusercontent.com/u/35830045?v=4)](https://github.com/qiyunhai "qiyunhai (1 commits)")

### Embed Badge

![Health badge](/badges/qiyunhai-webman-event/health.svg)

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

###  Alternatives

[keyword-extractor/keyword-extractor

A package to extract keywords from text

118.7k](/packages/keyword-extractor-keyword-extractor)[christianbarkowsky/tabcontrol

Create tabs as content element. Extension for Contao Open Source CMS

109.9k](/packages/christianbarkowsky-tabcontrol)

PHPackages © 2026

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