PHPackages                             pollora/hook - 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. pollora/hook

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

pollora/hook
============

A modern PHP package for WordPress hook (action/filter) management with callback resolution and reflection caching

v1.1.0(1mo ago)065GPL-2.0-or-laterPHPPHP ^8.2CI passing

Since Jun 23Pushed 1mo agoCompare

[ Source](https://github.com/Pollora/hook)[ Packagist](https://packagist.org/packages/pollora/hook)[ RSS](/packages/pollora-hook/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

Pollora Hook
============

[](#pollora-hook)

A modern PHP package for WordPress hook (action/filter) management with callback resolution and reflection caching.

Installation
------------

[](#installation)

```
composer require pollora/hook
```

Quick Start
-----------

[](#quick-start)

```
use Pollora\Hook\Action;
use Pollora\Hook\Filter;

$action = new Action;
$filter = new Filter;

// Register action
$action->add('init', function () {
    // runs on WordPress init
});

// Register filter
$filter->add('the_content', function (string $content): string {
    return $content . 'Appended!';
});

// Execute action
$action->do('my_custom_action', $arg1, $arg2);

// Apply filter
$filtered = $filter->apply('my_filter', $value);

// Remove hook
$action->remove('init', $callback);
```

> **Pollora framework users:** When the framework is available, prefer the Laravel facades `Pollora\Support\Facades\Action` and `Pollora\Support\Facades\Filter` for full DI container support. A notice is emitted if you use the standalone classes within the framework.

Class-based Callbacks
---------------------

[](#class-based-callbacks)

```
// Class with method matching hook name (StudlyCase convention)
$action->add('wp_loaded', MyInitializer::class);
// Resolves to [new MyInitializer, 'wpLoaded']

// With dependency injection
$action->setCallbackResolver($myResolver);
$action->add('wp_loaded', MyInitializer::class);
// Resolves via $myResolver->resolve(MyInitializer::class)
```

Documentation
-------------

[](#documentation)

See [docs/hooks.md](docs/hooks.md) for full documentation.

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance89

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Total

2

Last Release

57d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b45e81c070e2ec0baf59b2a73a216632d76cdfb36c0ab168fd6d043b2c8fbc2?d=identicon)[pollora](/maintainers/pollora)

---

Top Contributors

[![ogorzalka](https://avatars.githubusercontent.com/u/149651?v=4)](https://github.com/ogorzalka "ogorzalka (3 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pollora-hook/health.svg)

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

###  Alternatives

[vtalbot/pjax

PJAX for Laravel 4

4011.6k](/packages/vtalbot-pjax)

PHPackages © 2026

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