PHPackages                             wp-hooks/generator - 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. wp-hooks/generator

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

wp-hooks/generator
==================

Generates a JSON representation of the WordPress actions and filters in your code

1.0.1(1y ago)86178.4k↓39.1%9[1 issues](https://github.com/wp-hooks/generator/issues)[1 PRs](https://github.com/wp-hooks/generator/pulls)3GPL-3.0-or-laterPHPPHP &gt;=8.3

Since Nov 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/wp-hooks/generator)[ Packagist](https://packagist.org/packages/wp-hooks/generator)[ GitHub Sponsors](https://github.com/sponsors/johnbillion)[ RSS](/packages/wp-hooks-generator/feed)WikiDiscussions trunk Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (18)Used By (3)

WP Hooks Generator
==================

[](#wp-hooks-generator)

Generates a JSON representation of the WordPress actions and filters in your code. Can be used with WordPress plugins, themes, and core.

Note: If you just want the hook files without generating them yourself, use the following packages instead:

- [wp-hooks/wordpress-core](https://github.com/wp-hooks/wordpress-core) for WordPress core

Requirements
------------

[](#requirements)

PHP 8.3 or higher.

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

[](#installation)

```
composer require wp-hooks/generator
```

Generating the Hook Files
-------------------------

[](#generating-the-hook-files)

```
./bin/wp-hooks-generator --input=src --output=hooks
```

Usage of the Generated Hook Files in PHP
----------------------------------------

[](#usage-of-the-generated-hook-files-in-php)

```
// Get hooks as JSON:
$actions_json = file_get_contents( 'hooks/actions.json' );
$filters_json = file_get_contents( 'hooks/filters.json' );

// Convert hooks to PHP:
$actions = json_decode( $actions_json, true )['hooks'];
$filters = json_decode( $filters_json, true )['hooks'];

// Search for filters matching a string:
$search = 'permalink';
$results = array_filter( $filters, function( array $hook ) use ( $search ) {
    return ( strpos( $hook['name'], $search ) !== false );
} );

var_dump( $results );
```

Usage of the Generated Hook Files in JavaScript
-----------------------------------------------

[](#usage-of-the-generated-hook-files-in-javascript)

```
// Get hooks as array of objects:
const actions = require('hooks/actions.json').hooks;
const filters = require('hooks/filters.json').hooks;

// Search for actions matching a string:
const search = 'menu';
const results = actions.filter( hook => ( hook.name.match( search ) !== null ) );

console.log(results);
```

Ignoring Files or Directories
-----------------------------

[](#ignoring-files-or-directories)

You can ignore files or directories in two ways:

### On the Command Line

[](#on-the-command-line)

```
./vendor/bin/wp-hooks-generator --input=src --output=hooks --ignore-files="ignore/this,ignore/that"

```

### In composer.json

[](#in-composerjson)

```
"extra": {
    "wp-hooks": {
        "ignore-files": [
            "ignore/this",
            "ignore/that"
        ]
    }
}
```

Ignoring Hooks
--------------

[](#ignoring-hooks)

You can ignore hooks in two ways:

### On the Command Line

[](#on-the-command-line-1)

```
./vendor/bin/wp-hooks-generator --input=src --output=hooks --ignore-hooks="this_hook,that_hook"

```

### In composer.json

[](#in-composerjson-1)

```
"extra": {
    "wp-hooks": {
        "ignore-hooks": [
            "this_hook",
            "that_hook"
        ]
    }
}
```

TypeScript Interfaces for the Hook Files
----------------------------------------

[](#typescript-interfaces-for-the-hook-files)

The TypeScript interfaces for the hook files can be found in [`interface/index.d.ts`](interface/index.d.ts). Usage:

```
import { Hooks, Hook, Doc, Tags, Tag } from 'hooks/index.d.ts';
```

JSON Schema for the Hook Files
------------------------------

[](#json-schema-for-the-hook-files)

The JSON schema for the hook files can be found in [`schema.json`](schema.json).

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance42

Moderate activity, may be stable

Popularity46

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 97.1% 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 ~135 days

Recently: every ~243 days

Total

15

Last Release

470d ago

Major Versions

0.9.0 → 1.0.02024-12-04

PHP version history (2 changes)0.3.0PHP &gt;=7

1.0.0PHP &gt;=8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/208434?v=4)[John Blackbourn](/maintainers/johnbillion)[@johnbillion](https://github.com/johnbillion)

---

Top Contributors

[![johnbillion](https://avatars.githubusercontent.com/u/208434?v=4)](https://github.com/johnbillion "johnbillion (166 commits)")[![kkmuffme](https://avatars.githubusercontent.com/u/11071985?v=4)](https://github.com/kkmuffme "kkmuffme (4 commits)")[![pramodjodhani](https://avatars.githubusercontent.com/u/5794565?v=4)](https://github.com/pramodjodhani "pramodjodhani (1 commits)")

---

Tags

wordpress

### Embed Badge

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

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

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[roave/backward-compatibility-check

Tool to compare two revisions of a public API to check for BC breaks

5953.3M56](/packages/roave-backward-compatibility-check)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[phpdocumentor/reflection

Reflection library to do Static Analysis for PHP Projects

12521.4M109](/packages/phpdocumentor-reflection)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)

PHPackages © 2026

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