https://github.com/yardinternet/brave-hooks
Brave default hooks
https://github.com/yardinternet/brave-hooks
acorn brave wordpress
Last synced: 3 months ago
JSON representation
Brave default hooks
- Host: GitHub
- URL: https://github.com/yardinternet/brave-hooks
- Owner: yardinternet
- License: mit
- Created: 2024-11-19T15:51:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-04-01T12:00:25.000Z (3 months ago)
- Last Synced: 2026-04-01T12:06:50.461Z (3 months ago)
- Topics: acorn, brave, wordpress
- Language: PHP
- Homepage:
- Size: 336 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Brave Hooks
[](https://github.com/yardinternet/brave-hooks/actions/workflows/format-php.yml)
## Features
- [x] Register Hooks using php attributes
- [x] Configure Hook registration using a config file
- [x] Load plugin-specific hooks only when the plugin is active
## Installation
1. Install this package with Composer:
```sh
composer require yard/brave-hooks
```
2. Run the Acorn WP-CLI command to discover this package:
```shell
wp acorn package:discover
```
3. Publish the config file with:
```shell
wp acorn vendor:publish --provider="Yard\Brave\Hooks\HookServiceProvider"
```
5. Register all your project hooks in the published configuration file `config/hooks.php`.
## Usage
Add your custom hook classes to the [hooks configuration file](./config/hooks.php). Any hooks defined within these
classes will be automatically registered with WordPress.
This plugin leverages [wp-hook-registrar](https://github.com/yardinternet/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()](https://developer.wordpress.org/reference/functions/is_plugin_active/)
```php
#[Plugin('advanced-custom-fields-pro/acf.php')]
class ACF
{
...
}
```
## About us
[](https://www.yard.nl/werken-bij/)