PHPackages                             seanhepps/hooks - 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. seanhepps/hooks

ActiveLibrary

seanhepps/hooks
===============

类似WordPress的钩子机制

1.0.1(5y ago)06MITPHPPHP &gt;=7.0

Since May 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/seanhepps/hooks)[ Packagist](https://packagist.org/packages/seanhepps/hooks)[ Docs](https://github.com/seanhepps/hooks)[ RSS](/packages/seanhepps-hooks/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

hooks
=====

[](#hooks)

类似WordPress的钩子机制，单独的类包，可直接用于laravel、thinkphp等框架

laravel添加服务提供者
--------------

[](#laravel添加服务提供者)

`\seanhepps\hooks\HookServiceProvider::class`

添加别名
----

[](#添加别名)

`'Hook'  =>  \seanhepps\hooks\Facades\Hook::class`

添加钩子
----

[](#添加钩子)

`Hook::getAction()->register($name, $class, 20)`

保存到文件
-----

[](#保存到文件)

`Hook::getAction()->save()`

如果想要更换缓存文件保存位置，可以修改Base类构造函数中的保存路径

监听
--

[](#监听)

`Hook::action($hookName, $args)`

使用过滤器
-----

[](#使用过滤器)

使用过滤器和使用action钩子用法一模一样，只需要把上面`getAction`替换成`getFilter`就可以了

过滤器监听
-----

[](#过滤器监听)

`$result = Hook::filter($hookName, $args)`

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Every ~2 days

Total

3

Last Release

2174d ago

Major Versions

0.9.1 → 1.0.02020-05-29

PHP version history (2 changes)0.9.1PHP ^5.6.0

1.0.0PHP &gt;=7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39003515?v=4)[Sean](/maintainers/seanhepps)[@seanhepps](https://github.com/seanhepps)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/seanhepps-hooks/health.svg)

```
[![Health](https://phpackages.com/badges/seanhepps-hooks/health.svg)](https://phpackages.com/packages/seanhepps-hooks)
```

PHPackages © 2026

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