PHPackages                             shineunited/wordpress-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. shineunited/wordpress-hooks

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

shineunited/wordpress-hooks
===========================

Tool for managing WordPress hooks prior to initialization.

10PHP

Since Jan 17Pushed 3y ago4 watchersCompare

[ Source](https://github.com/shineunited/wordpress-hooks)[ Packagist](https://packagist.org/packages/shineunited/wordpress-hooks)[ RSS](/packages/shineunited-wordpress-hooks/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

shineunited/wordpress-hooks
===========================

[](#shineunitedwordpress-hooks)

[![License](https://camo.githubusercontent.com/a47bb1f571ebec5a085bc755cad9e6ba12c091a4605562dc84efbff4095404b6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7368696e65756e697465642f776f726470726573732d686f6f6b73)](https://github.com/shineunited/wordpress-hooks/blob/main/LICENSE)[![Latest Version](https://camo.githubusercontent.com/02d69ffcb328cf76701e999b85cb68344b3f717463c2b7c0d43e887d64325c5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368696e65756e697465642f776f726470726573732d686f6f6b733f6c6162656c3d6c6174657374)](https://packagist.org/packages/shineunited/wordpress-hooks/)[![PHP Version](https://camo.githubusercontent.com/5ba6bd2c0c4fccf77678c61b9fbe164f32987c1a78f8caacea8ddbc565ce5761/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f7368696e65756e697465642f776f726470726573732d686f6f6b732f7068703f6c6162656c3d706870)](https://www.php.net/releases/index.php)[![Main Status](https://camo.githubusercontent.com/78b4b0ea7eb9adf358e78812cd1fe2f6cb904d89c5c0fd0943c852f4511ca1ca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7368696e65756e697465642f776f726470726573732d686f6f6b732f6275696c642e796d6c3f6272616e63683d6d61696e266c6162656c3d6d61696e)](https://github.com/shineunited/wordpress-hooks/actions/workflows/build.yml?query=branch%3Amain)[![Release Status](https://camo.githubusercontent.com/6954edb15448130406e1e752c41be3d46d031ce2fb022d9771da85e6bed4cf0c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7368696e65756e697465642f776f726470726573732d686f6f6b732f6275696c642e796d6c3f6272616e63683d72656c65617365266c6162656c3d72656c65617365)](https://github.com/shineunited/wordpress-hooks/actions/workflows/build.yml?query=branch%3Arelease)[![Develop Status](https://camo.githubusercontent.com/a9acd23915e662e05542049032f33b7f2550b972e7d5c42e9f709b0f77d7c959/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7368696e65756e697465642f776f726470726573732d686f6f6b732f6275696c642e796d6c3f6272616e63683d646576656c6f70266c6162656c3d646576656c6f70)](https://github.com/shineunited/wordpress-hooks/actions/workflows/build.yml?query=branch%3Adevelop)

Description
-----------

[](#description)

A tool for managing WordPress hooks. Allows registration of hooks prior to WordPress initialization and provides a framework for defining hooks using PHP attributes.

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

[](#installation)

to add wordpress-hooks, the recommended method is via composer.

```
$ composer require shineunited/wordpress-hooks
```

### HookManager

[](#hookmanager)

The HookManager class provides static methods for managing WordPress hooks. While most of the functions are simply aliased to the built-in WordPress functions, some of them all management of hooks prior to initialization.

```
use ShineUnited\WordPress\Hooks\HookManager;

function callback_function($param1, $param2) {
	// code
}

// this can be used prior to initialization
HookManager::addFilter('filter-name', 'callback-function', 10, 2);
```

### Attribute Hooks

[](#attribute-hooks)

Hooks can also be defined by using the Hook attributes and HookManager::register();

```
use ShineUnited\WordPress\Hooks\Filter;
use ShineUnited\WordPress\Hooks\HookManager;

class MyObjectHooks {

	#[Filter('lowercase')]
	public function lowercase(string $value): string {
		return strtolower($value);
	}

	#[Filter('uppercase')]
	public function uppercase(string $value): string {
		return strtoupper($value);
	}
}

$hooks = new MyObjectHooks();
HookManager::register($hooks);
// WordPress Equivalent
//   add_filter('lowercase', [$hooks, 'lowercase'], 10, 1);
//   add_filter('uppercase', [$hooks, 'uppercase'], 10, 1);
```

Multiple hooks can be applied to a single callback.

```
use ShineUnited\WordPress\Hooks\Action;
use ShineUnited\WordPress\Hooks\Filter;
use ShineUnited\WordPress\Hooks\HookManager;

$closure =
#[Filter('example-filter', 12)]
#[Action('example-action')]
function($value) {
	// code
};

HookManager::register($closure);
// WordPress Equivalent:
//   add_filter('example-filter', $closure, 12, 1);
//   add_filter('example-action', $closure, 10, 1);
```

### Function Reference

[](#function-reference)

For more details and examples please see our [documentation](https://shineunited.github.io/wordpress-hooks).

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 95.8% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8301342?v=4)[Shine United](/maintainers/shineunited)[@shineunited](https://github.com/shineunited)

---

Top Contributors

[![rmlasseter](https://avatars.githubusercontent.com/u/5660821?v=4)](https://github.com/rmlasseter "rmlasseter (23 commits)")[![shineadmin](https://avatars.githubusercontent.com/u/3662582?v=4)](https://github.com/shineadmin "shineadmin (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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