Simple copy of WordPress' WP_Hook class with some adjustments to use outside of WordPress.
No dependencies!
Because I like these WordPress "filters" and they "cost" almost nothing. And sine I use them in other projects it's easier to make them public anyways.
Via composer
composer require simplemediacode/hooks
and then
use SimpleMediaCode\Hooks\WP_Hook;
See ActionHooks.php in example
folder (which is autoloaded too). Or wrap in your own solution.
I use them inside classes and/or in helper functions.
Should be compatible with WordPress (works on my machine). "Tested" with PHP 8.2.22.
Read at CHANGELOG.md.
More about how to use WordPress hooks (filters and actions) read at wordpress.org: "WP_Hook: Next Generation Actions and Filters". Instead of $wp_*
here use $wphook_*
for compatiblity.
Most of job done by WordPress team and collaborators
This library is released under the GLP-2 license. See the complete license in the bundled LICENSE file.