PHPackages                             wpdiggerstudio/wpzylos-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. [Framework](/categories/framework)
4. /
5. wpdiggerstudio/wpzylos-hooks

ActiveLibrary[Framework](/categories/framework)

wpdiggerstudio/wpzylos-hooks
============================

WordPress hook management with plugin-scoped custom hooks for WPZylos framework

v1.0.0(5mo ago)02311MITPHPPHP ^8.0CI failing

Since Feb 1Pushed 2w agoCompare

[ Source](https://github.com/WPDiggerStudio/wpzylos-hooks)[ Packagist](https://packagist.org/packages/wpdiggerstudio/wpzylos-hooks)[ Docs](https://github.com/WPDiggerStudio/wpzylos-hooks)[ Fund](https://www.paypal.com/donate/?hosted_button_id=66U4L3HG4TLCC)[ RSS](/packages/wpdiggerstudio-wpzylos-hooks/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (1)

WPZylos Hooks
=============

[](#wpzylos-hooks)

[![PHP Version](https://camo.githubusercontent.com/911a83e2aa6fe73660ab613629a95c76622bf03049a7344e80c5ea72d4ef9c7d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e302d626c7565)](https://php.net)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)[![GitHub](https://camo.githubusercontent.com/dbe820b98864e115173c422b9472b725cfa678bee03b66ff2c453dad95a3d20b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d575044696767657253747564696f2d3138313731373f6c6f676f3d676974687562)](https://github.com/WPDiggerStudio/wpzylos-hooks)

WordPress hook management with plugin-scoped custom hooks for WPZylos framework.

📖 **[Full Documentation](https://wpzylos.com)** | 🐛 **[Report Issues](https://github.com/WPDiggerStudio/wpzylos-hooks/issues)**

---

✨ Features
----------

[](#-features)

- **Dual Hook API** — Separate methods for WordPress core hooks and custom plugin hooks
- **Auto-Prefixed Custom Hooks** — Plugin-scoped hooks prevent naming collisions
- **Fluent API** — Chainable methods for clean registration
- **One-Time Hooks** — Actions that self-remove after first execution
- **Hook Registry** — Introspect all registered actions and filters

---

📋 Requirements
--------------

[](#-requirements)

RequirementVersionPHP^8.0WordPress6.0+---

🚀 Installation
--------------

[](#-installation)

```
composer require wpdiggerstudio/wpzylos-hooks
```

---

📖 Quick Start
-------------

[](#-quick-start)

```
use WPZylos\Framework\Hooks\HookManager;

$hooks = $app->make('hooks');

// WordPress core hooks (NEVER prefixed) — use wp* methods
$hooks->wpAction('init', [$this, 'initialize']);
$hooks->wpFilter('the_content', [$this, 'modifyContent']);

// Custom plugin hooks (ALWAYS prefixed) — use plain methods
$hooks->action('settings_saved', [$listener, 'onSettingsSaved']);
$hooks->filter('settings', [$this, 'filterSettings']);

// Fire & apply custom hooks
$hooks->doAction('settings_saved', $settings);
$filtered = $hooks->applyFilter('settings', $defaults);
```

---

🏗️ Core Concepts
----------------

[](#️-core-concepts)

### The Dual API

[](#the-dual-api)

HookManager provides two distinct APIs:

PurposeRegister ListenerFire / ApplyRemove**WordPress hooks**`wpAction()`, `wpFilter()`*(WordPress fires these)*`removeWpAction()`, `removeWpFilter()`**Custom plugin hooks**`action()`, `filter()``doAction()`, `applyFilter()``removeAction()`, `removeFilter()`**WordPress hooks** (`wp*` methods) use the hook name exactly as provided — `'init'`, `'the_content'`, etc.

**Custom plugin hooks** (plain methods) automatically prefix the hook name via `$context->hook()` to prevent collisions between plugins.

### WordPress Core Hooks

[](#wordpress-core-hooks)

```
// Register actions on WordPress hooks
$hooks->wpAction('init', [$this, 'onInit']);
$hooks->wpAction('admin_menu', [$this, 'registerMenu'], 20);

// Register filters on WordPress hooks
$hooks->wpFilter('the_title', [$this, 'filterTitle']);
$hooks->wpFilter('body_class', [$this, 'addBodyClasses'], 10, 2);

// Remove hooks
$hooks->removeWpAction('init', [$this, 'onInit']);
$hooks->removeWpFilter('the_title', [$this, 'filterTitle']);
```

### Custom Plugin Hooks

[](#custom-plugin-hooks)

```
// Register listeners on your plugin's custom hooks
// If your plugin prefix is "myplugin", 'user_created' becomes 'myplugin_user_created'
$hooks->action('user_created', [$listener, 'onUserCreated']);
$hooks->filter('settings', [$this, 'filterSettings']);

// Fire a custom action
$hooks->doAction('user_created', $user);

// Apply a custom filter
$settings = $hooks->applyFilter('settings', $defaults);

// Remove custom hook listeners
$hooks->removeAction('user_created', [$listener, 'onUserCreated']);
$hooks->removeFilter('settings', [$this, 'filterSettings']);
```

### One-Time Hooks

[](#one-time-hooks)

```
// Executes once then removes itself automatically
$hooks->once('init', function () {
    // Runs only on the first 'init' call
});
```

### Fluent Chaining

[](#fluent-chaining)

```
$hooks
    ->wpAction('init', [$this, 'onInit'])
    ->wpAction('admin_menu', [$this, 'registerMenu'])
    ->wpFilter('the_content', [$this, 'filterContent']);
```

---

📦 Related Packages
------------------

[](#-related-packages)

PackageDescription[wpzylos-core](https://github.com/WPDiggerStudio/wpzylos-core)Application foundation[wpzylos-events](https://github.com/WPDiggerStudio/wpzylos-events)PSR-14 event dispatcher[wpzylos-scaffold](https://github.com/WPDiggerStudio/wpzylos-scaffold)Plugin template---

📖 Documentation
---------------

[](#-documentation)

For comprehensive documentation, tutorials, and API reference, visit **[wpzylos.com](https://wpzylos.com)**.

---

☕ Support the Project
---------------------

[](#-support-the-project)

- [GitHub Sponsors](https://github.com/sponsors/wpdiggerstudio)
- [PayPal Donate](https://www.paypal.com/donate/?hosted_button_id=66U4L3HG4TLCC)

---

📄 License
---------

[](#-license)

MIT License. See [LICENSE](LICENSE) for details.

---

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

**Made with ❤️ by [WPDiggerStudio](https://github.com/WPDiggerStudio)**

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance86

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

151d ago

### Community

Maintainers

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

---

Top Contributors

[![WPDiggerStudio](https://avatars.githubusercontent.com/u/55980087?v=4)](https://github.com/WPDiggerStudio "WPDiggerStudio (9 commits)")

---

Tags

wordpresseventshooksfiltersactionswpzylos

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[tormjens/eventy

The WordPress filter/action system in Laravel

439951.1k24](/packages/tormjens-eventy)[millat/laravel-hooks

The WordPress filter, action system in Laravel

5817.5k](/packages/millat-laravel-hooks)[x-wp/di

The dependency injection container for WordPress

314.3k13](/packages/x-wp-di)

PHPackages © 2026

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