PHPackages                             onepix/wordpress-hooks-stub-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. onepix/wordpress-hooks-stub-generator

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

onepix/wordpress-hooks-stub-generator
=====================================

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

v2.1.4(1y ago)05908GPL-3.0-or-laterPHPPHP &gt;=8.1

Since Dec 4Pushed 1y agoCompare

[ Source](https://github.com/0zd0/wordpress-hooks-stub-generator)[ Packagist](https://packagist.org/packages/onepix/wordpress-hooks-stub-generator)[ GitHub Sponsors](https://github.com/sponsors/johnbillion)[ RSS](/packages/onepix-wordpress-hooks-stub-generator/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelogDependencies (11)Versions (15)Used By (8)

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.

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

[](#installation)

```
composer require onepix/wordpress-hooks-stub-generator
```

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

[](#requirements)

PHP: 8.1+

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

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

```
./bin/generate-hooks --input=src --input=additional --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"

```

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"

```

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

33

—

LowBetter than 75% of packages

Maintenance41

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

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

13

Last Release

491d ago

Major Versions

v1.0.4 → v2.0.02025-01-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/380c3a3697647ffa6dacfa3f41ef2d8ea43a40a12a823d380b843b57ac14750c?d=identicon)[onepix](/maintainers/onepix)

![](https://www.gravatar.com/avatar/7f618d5c06c711c1eada5b9569aad7cee6d81e830566775e7734dd87828e8fdc?d=identicon)[0zd0](/maintainers/0zd0)

---

Top Contributors

[![johnbillion](https://avatars.githubusercontent.com/u/208434?v=4)](https://github.com/johnbillion "johnbillion (165 commits)")[![0zd0](https://avatars.githubusercontent.com/u/67220210?v=4)](https://github.com/0zd0 "0zd0 (20 commits)")[![kkmuffme](https://avatars.githubusercontent.com/u/11071985?v=4)](https://github.com/kkmuffme "kkmuffme (4 commits)")

---

Tags

PHPStanwordpressstatic analysispsalm

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/onepix-wordpress-hooks-stub-generator/health.svg)

```
[![Health](https://phpackages.com/badges/onepix-wordpress-hooks-stub-generator/health.svg)](https://phpackages.com/packages/onepix-wordpress-hooks-stub-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.1M565](/packages/symfony-maker-bundle)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[php-stubs/wordpress-stubs

WordPress function and class declaration stubs for static analysis.

19013.0M263](/packages/php-stubs-wordpress-stubs)[php-stubs/woocommerce-stubs

WooCommerce function and class declaration stubs for static analysis.

942.9M66](/packages/php-stubs-woocommerce-stubs)[php-stubs/wp-cli-stubs

WP-CLI function and class declaration stubs for static analysis.

302.3M79](/packages/php-stubs-wp-cli-stubs)[php-stubs/generator

Generate stubs from any PHP code for IDE completion and static analysis.

79291.0k45](/packages/php-stubs-generator)

PHPackages © 2026

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