PHPackages                             nabeghe/hooker - 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. nabeghe/hooker

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

nabeghe/hooker
==============

A simple hook system library (actions and filters) based on Symfony EventDispatcher.

v0.3.3(10mo ago)355MITPHPPHP &gt;=8.2

Since Sep 19Pushed 10mo ago1 watchersCompare

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

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

Hooker for PHP
==============

[](#hooker-for-php)

 [![](https://private-user-images.githubusercontent.com/12207627/452823764-904b09e6-520b-488e-b060-114b54dbdc64.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU0ODg2MjgsIm5iZiI6MTc3NTQ4ODMyOCwicGF0aCI6Ii8xMjIwNzYyNy80NTI4MjM3NjQtOTA0YjA5ZTYtNTIwYi00ODhlLWIwNjAtMTE0YjU0ZGJkYzY0LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDA2VDE1MTIwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEzNzEyZjI1N2I5MGViNDQxM2ZlYWZkZmE4MDFlOWU3MjZhODI5YTNlNDFjMDM5MDY5NTM4NmNkMDIyYzBjZmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.u2MX6zJ24Y6fPu8EQO6qlaaX6Bt3MyDusQS5m13irjc)](https://private-user-images.githubusercontent.com/12207627/452823764-904b09e6-520b-488e-b060-114b54dbdc64.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU0ODg2MjgsIm5iZiI6MTc3NTQ4ODMyOCwicGF0aCI6Ii8xMjIwNzYyNy80NTI4MjM3NjQtOTA0YjA5ZTYtNTIwYi00ODhlLWIwNjAtMTE0YjU0ZGJkYzY0LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDA2VDE1MTIwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEzNzEyZjI1N2I5MGViNDQxM2ZlYWZkZmE4MDFlOWU3MjZhODI5YTNlNDFjMDM5MDY5NTM4NmNkMDIyYzBjZmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.u2MX6zJ24Y6fPu8EQO6qlaaX6Bt3MyDusQS5m13irjc)

> A simple hook system library (actions and filters) based on Symfony EventDispatcher.

🫡 Usage
-------

[](#-usage)

### 🚀 Installation

[](#-installation)

You can install the package via composer:

```
composer require nabeghe/hooker
```

### Examples

[](#examples)

#### Action

[](#action)

```
require 'vendor/autoload.php';

use Nabeghe\Hooker\Hooker;
use Nabeghe\Hooker\Hook;

$hooker = new Hooker();

$hooker->setDefaultArgToHooks('protocol', 'https://');

$hooker->listen('your_custom_action_name', function (Hook $action) {
    echo $action['protocol'].$action['url'].PHP_EOL;
}, 2); // priority = 2

$hooker->action('your_custom_action_name', ['url' => 'https://github.com/nabeghe/hooker']);
```

#### Filter:

[](#filter)

```
require 'vendor/autoload.php';

use Nabeghe\Hooker\Hooker;
use Nabeghe\Hooker\Hook;

$hooker = new Hooker();

$hooker->listen('your_custom_filter_name', function (Hook $filter) {
    if ($filter->getValue() === null) {
        $filter->setValue(8 + $filter['default']);
    }
});

$value = $hooker->filter('your_custom_filter_name', null, ['default' => 5]);
echo $value; // 13
```

📖 License
---------

[](#-license)

Licensed under the MIT license, see [LICENSE.md](LICENSE.md) for details.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance54

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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 ~71 days

Total

5

Last Release

319d ago

### Community

Maintainers

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

---

Top Contributors

[![nabeghe](https://avatars.githubusercontent.com/u/12207627?v=4)](https://github.com/nabeghe "nabeghe (6 commits)")

---

Tags

eventeventdispatchereventshookhooksphpsymfonyeventsymfonyevent dispatcherevent systemfilterHOOKactionhook-systemhooker

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nabeghe-hooker/health.svg)

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

###  Alternatives

[doctrine/event-manager

The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.

6.1k501.1M115](/packages/doctrine-event-manager)[tormjens/eventy

The WordPress filter/action system in Laravel

438912.9k16](/packages/tormjens-eventy)[contributte/event-dispatcher

Best event dispatcher / event manager / event emitter for Nette Framework

292.4M19](/packages/contributte-event-dispatcher)

PHPackages © 2026

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