pentagonal / hookable
Hook able Library like a WordPress uses
Installs: 134
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/pentagonal/hookable
Requires
- php: >=5.3
Requires (Dev)
- phpunit/phpunit: 4.5.*
This package is not auto-updated.
Last update: 2025-09-25 05:45:28 UTC
README
Hook able Library like a WordPress uses
Usage
$hook = new \Pentagonal\Hookable\Hookable(); /** * Add Hook into functions example */ function thIsIsOnHookReturn() { global $hooks; /** * .... run the code */ $the_result = array('array_result'); // the returning result return $hook->apply('callback_name', $the_result); } /** * in here * Calling thIsIsOnHookReturn() * will be returning array */ var_dump(thIsIsOnHookReturn()); /** * add filter / action on determined callback */ $hook->add( 'callback_name', // the callback function ($returning_old_result) { $new_result = print_r($returning_result, true); return $new_result; }, 10, // priority 1 // arguments accepted ); /** * in here * Calling thIsIsOnHookReturn() * will be returning string of array printed */ var_dump(thIsIsOnHookReturn());
Install
{ "require": { "pentagonal/hookable": "^1" } }