Download the PHP package kaiseki/wp-hook without Composer
On this page you can find all versions of the php package kaiseki/wp-hook. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kaiseki/wp-hook
More information about kaiseki/wp-hook
Files in kaiseki/wp-hook
Package wp-hook
Short Description Register classes with add_filter and add_action hooks
License MIT
Homepage https://github.com/kaisekidev/kaiseki-wp-hook
Informations about the package wp-hook
kaiseki/wp-hook
Register classes with add_filter and add_action hooks.
A hook provider is any object implementing HookProviderInterface — its single
addHooks() method is where you wire WordPress callbacks with add_action() and
add_filter(). You list your provider classes under the hook.provider config key,
and HookProviderRegistry instantiates them through the container and calls addHooks()
on each, so every theme or plugin registers its hooks from one place.
Installation
Requires PHP 8.2 or newer.
Usage
Implement HookProviderInterface and register your WordPress hooks inside addHooks():
Add the class name to the hook.provider config key:
ConfigProvider maps HookProviderRegistry to HookProviderRegistryFactory, which reads
hook.provider from the container, instantiates each provider, and builds the registry.
Calling addHooks() on the registry then fans out to every provider:
Wire ConfigProvider into your application's config aggregator (e.g. laminas-config-aggregator)
to register the factory.
Development
License
MIT — see LICENSE.