Download the PHP package pinkcrab/wp-hook-subscriber without Composer
On this page you can find all versions of the php package pinkcrab/wp-hook-subscriber. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pinkcrab/wp-hook-subscriber
More information about pinkcrab/wp-hook-subscriber
Files in pinkcrab/wp-hook-subscriber
Package wp-hook-subscriber
Short Description Creates a single subscriber for a hook, part of the PinkCrab Perique Framework
License MIT
Homepage https://pinkcrab.co.uk
Informations about the package wp-hook-subscriber
Perique Hook Subscriber
Creates a single subscriber for a hook, part of the PinkCrab Plugin Framework
Requirements
Requires PinkCrab Perique Framework V2.0.*
Installation
This module allows for the creation of single Hook Subscriptions for creating an interface with WordPress. Under the hood it still uses the same registration process, the PinkCrab framework is built on, but gives a clean abstraction for single calls.
Each class which extends the provided base class, will have its hook added to the loader on either the defined action or differed. Allowing full use of the DI container.
Due to the way the Loader registers hook calls, classes are instanced on the init hook. Which can be problematic for WooCommerce and other extendable plugins, where some globals are populated later. The Hook_Subscriber allows for late construction, so your callback will be created in the global scope at that time.
None Deferred Subscriber
Deferred Subscriber
Somewhere in another plugin or wp-core $some_global is populated, we can then hook in anytime from when thats created and our hook is actually called.
When some_global_populated is fired, a new instance of Deferred_Hook is created and the callback is registered. This gives us access to Some_Global no matter whenever some_global_populated(). We end up creating 2 instances of our deferred hooks, once on init to register the first call, then again on our deferred hook, for the actual hook call.
Previous Versions
- For Perique V1.0. use Version 1.0.
- For Perique V0.4.* use Version 0.2.2
- For Perique V0.3.* use Version 0.2.1
Changelog
- 2.0.1 - Updates dev dependencies
- 2.0.0 - Drops support for PHP 7.2 & 7.3 and adds support for Perique V2.0.*
- 1.0.1 - Drops support for PHP 7.1, adds PHP8 support, updates all dependencies and adds 3rd party quality checks (Scrutinizer & CodeClimate)
- 1.0.0 - Now supports Perique and its move from Registerable to Hookable interface naming.
- ---- Core renamed from PinkCrab Plugin Framework to Perique ----
- 0.2.2 Updated tests and code to reflect changes in Framework 0.4.*
- 0.2.1 Added in a extra tests and coverage reports.
- 0.2.0 - Moved from the initial Event_Hook naming and made a few minor changes to how deferred hooks are added, using DI to recreate an new instance, over resetting state.