yard / brave-hooks
Brave hooks
Requires
- php: >=8.2
- ext-dom: *
- ext-intl: *
- ext-libxml: >=8.1
- lib-libxml: >=2.9
- roots/acorn: ^5.0
- spatie/laravel-csp: ^2.10
- spatie/laravel-package-tools: ^1.16
- yard/wp-hook-registrar: ^2.0
Requires (Dev)
- 10up/wp_mock: ^0.4.2
- pestphp/pest: ^3.0 || ^4.0 || ^5.0
- php-stubs/gravity-forms-stubs: ^2.9
- szepeviktor/phpstan-wordpress: ^2.0
- yard/php-cs-fixer-rules: ^1.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v3.1.1
- v3.1.0
- v3.0.1
- v3.0.0
- v2.9.2
- v2.9.1
- v2.9.0
- v2.8
- v2.7.9
- v2.7.8
- v2.7.7
- v2.7.6
- v2.7.5
- v2.7.4
- v2.7.3
- v2.7.2
- v2.7.1
- v2.7.0
- v2.6.1
- v2.6.0
- v2.5.1
- v2.5.0
- v2.4.0
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.0.1
- v2.0.0
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-refactor/transliterate-filenames
- dev-a11y/gravityforms-ol-to-ul
- dev-a11y/remove-empty-headings
- dev-fix/facetwp-assets
- dev-fix/sc-9666
- dev-feat/disable-language-select
- dev-feat/undo-facetwp-pagination-html-nav
- dev-feat/allow-thumbnail-sizes
- dev-feat/reassign_posts_when_removing_user_from_blog
This package is auto-updated.
Last update: 2026-09-15 08:13:11 UTC
README
Features
- Register Hooks using php attributes
- Configure Hook registration using a config file
- Load plugin-specific hooks only when the plugin is active
Installation
-
Install this package with Composer:
composer require yard/brave-hooks
-
Run the Acorn WP-CLI command to discover this package:
wp acorn package:discover
-
Publish the config file with:
wp acorn vendor:publish --provider="Yard\Brave\Hooks\HookServiceProvider" -
Register all your project hooks in the published configuration file
config/hooks.php.
Usage
Add your custom hook classes to the hooks configuration file. Any hooks defined within these classes will be automatically registered with WordPress.
This plugin leverages wp-hook-registrar for hook registration. For detailed information about the hook registration process, please refer to that package's documentation.
Plugin-specific Hooks
Some classes contain hooks that should only be active when a specific WordPress plugin is active.
To achieve this, add the #[Plugin] attribute to the class containing hooks and provide the plugin's file path:
The plugin path should match the format required by the WordPress function is_plugin_active()
#[Plugin('advanced-custom-fields-pro/acf.php')] class ACF { ... }