PHPackages                             shinepress/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. [Search &amp; Filtering](/categories/search)
4. /
5. shinepress/hooks

ActiveLibrary[Search &amp; Filtering](/categories/search)

shinepress/hooks
================

Tools for managing WordPress hooks before and after initialization

1.0.0(1y ago)021MITPHPPHP &gt;=8.1CI passing

Since May 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/shinepress/hooks)[ Packagist](https://packagist.org/packages/shinepress/hooks)[ RSS](/packages/shinepress-hooks/feed)WikiDiscussions main Synced today

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

shinepress/hooks
================

[](#shinepresshooks)

[![License](https://camo.githubusercontent.com/c44e1d7b25f0800d045554ca30fed2daa10bba60c31753af67c5ccce45f59d47/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7368696e6570726573732f686f6f6b73)](https://github.com/shinepress/hooks/blob/main/LICENSE)[![Latest Version](https://camo.githubusercontent.com/dcab2049817582802b5deac4bef3ca3413f088481255b3f047216e31bb611c94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368696e6570726573732f686f6f6b733f6c6162656c3d6c6174657374)](https://packagist.org/packages/shinepress/hooks/)[![PHP Version](https://camo.githubusercontent.com/a89e9a14af5826535c99ed6741d6cb5db79b75d0bc773bdd5ac8d24d759e8563/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f7368696e6570726573732f686f6f6b732f7068703f6c6162656c3d706870)](https://www.php.net/releases/index.php)[![Main Status](https://camo.githubusercontent.com/00cd968fe9123648b12057767d0027dad8f2cc9ba39566f03a8ba7893dd2103b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7368696e6570726573732f686f6f6b732f7665726966792e796d6c3f6272616e63683d6d61696e266c6162656c3d6d61696e)](https://github.com/shinepress/hooks/actions/workflows/verify.yml?query=branch%3Amain)[![Release Status](https://camo.githubusercontent.com/1273497445788c6e0dee8f5ff27244aa5df15c72986d51c2c8b1c9584a47da1c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7368696e6570726573732f686f6f6b732f7665726966792e796d6c3f6272616e63683d72656c65617365266c6162656c3d72656c65617365)](https://github.com/shinepress/hooks/actions/workflows/verify.yml?query=branch%3Arelease)[![Develop Status](https://camo.githubusercontent.com/416d0dca157fbea61c4dfb1092387de92ac6df09b7104f652a7a36ccc931486a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7368696e6570726573732f686f6f6b732f7665726966792e796d6c3f6272616e63683d646576656c6f70266c6162656c3d646576656c6f70)](https://github.com/shinepress/hooks/actions/workflows/verify.yml?query=branch%3Adevelop)

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

[](#description)

A tool for managing WordPress hooks. Allows registration of hooks prior to WordPress initialization as well as providing attributes that can be used for the same purpose in conjuction with the ShinePress [framework](https://packagist.org/packages/shinepress/framework/).

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

[](#installation)

The recommendend installation method is with composer:

```
$ composer require shinepress/hooks
```

Usage
-----

[](#usage)

### HookManager

[](#hookmanager)

The HookManager class provides static methods for managing WordPress hooks.

```
use ShinePress\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)

When using the framework, hooks can be defined by adding attributes to functions in your custom module class.

```
use ShinePress\Framework\Module;
use ShinePress\Hooks\Filter;

class CustomModule extends Module {

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

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

CustomModule::register();
// WordPress Equivalent:
//     add_filter('lowercase', [CustomModule::instance(), 'lowercase'], 10, 1);
//     add_filter('uppercase', [CustomModule::instance(), 'uppercase'], 10, 1);
```

Multiple hooks can also be applied to a single callback.

```
use ShinePress\Framework\Module;
use ShinePress\Hooks\Action;
use ShinePress\Hooks\Filter;

class CustomModule extends Module {

	#[Filter('example-filter', 12)]
	#[Action('example-action')]
	public function exampleFunction(mixed $value) {
		// do something
	}
}

CustomModule::register();
// WordPress Equivalent:
//     add_filter('example-filter', [CustomModule::instance(), 'exampleFunction'], 12, 1);
//     add_action('example-action', [CustomModule::instance(), 'exampleFunction'], 10, 1);
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance46

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

409d ago

### 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 (28 commits)")[![shineadmin](https://avatars.githubusercontent.com/u/3662582?v=4)](https://github.com/shineadmin "shineadmin (1 commits)")

---

Tags

wordpressfilterHOOKaction

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/shinepress-hooks/health.svg)](https://phpackages.com/packages/shinepress-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)[mjohnson/decoda

A lightweight lexical string parser for BBCode styled markup.

1921.3M14](/packages/mjohnson-decoda)[mitogh/katana

Filters to control where the size of images are generated.

204.4k](/packages/mitogh-katana)

PHPackages © 2026

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