Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 81 | All time: 10,102 This week: 660![]() |
Version | License | PHP version | Categories | |||
hookmgr 1.0 | GNU Lesser Genera... | 5 | PHP 5, Language |
Description | Author | |
This class can register and invoke hook callback functions. |
|
> Class HookMgr manages PHP hooks > A hook is a (HookMgr) key for invoking callable(s)
A callable can be * simple function * anonymous function * instantiated object+method : \[ $object, 'methodName' ] * class name and static method : \[ 'namespaceClassName', 'methodName' ] * instantiated object, class with (magic) __call method : \[ $object, 'someMethod' ] * class name, class with (magic) __callStatic method : \[ 'namespaceClassName', 'someMethod' ] * instantiated object, class with (magic) __invoke method : $object
Define a hook with callable
HookMgr::addAction( $hook, $callable );
Invoke callable using hook
$result = HookMgr::apply( $hook );
* Add single hook with single callable, _syntax_only_ callable check
* ```hook``` _string_
* ```callable``` _callable_
* Throws InvalidArgumentException
* static
-
-
Throws InvalidArgumentException
-
static
* Set all hooks, each for invoking single or array of callables
`
actions`
_array_( hook => callable(s) )
* Throws InvalidArgumentException
* static
---
-
Invoke 'hook' action(s), return (last) result
-
-
* Opt arguments are used in all hook invokes
* To use an argument by-reference, use ```HookMgr::apply( 'hook', [ & $arg ] );```
-
Return _mixed_
-
Throws RuntimeException
-
static
* Return
* count of hooks
* count of callables for hook
* not found hook return 0
* ```hook``` _string_
* Return bool
* static
-
-
Return bool, true if hook is set
-
static
* Return array callables for hook, not found return []
* ```hook``` _string_
* Return _callable\[]_
* static
-
Return _array_ (string[]) hooks
-
static
* Clear (remove) all hooks with callables
* static
-
Remove single hook with callable(s)
-
-
static
* Return _string_ nice rendered hooks with callable(s)
* static
###### Sponsorship
Donation using <a href="https://paypal.me/kigkonsult?locale.x=en_US" rel="nofollow">paypal.me/kigkonsult</a> are appreciated.
For invoice, <a href="mailto:ical@kigkonsult.se">please e-mail</a>.
###### INSTALL
composer require kigkonsult/hookmgr:dev-master
Composer, in your `composer.json`:
{
"require": {
"kigkonsult/hookmgr": "dev-master"
}
}
Composer, acquire access
use Kigkonsult\HookMgr\HookMgr;
...
include 'vendor/autoload.php';
Otherwise , download and acquire..
use Kigkonsult\HookMgr\HookMgr;
...
include 'pathToSource/kigkonsult/HookMgr/autoload.php';
###### Support
For support go to [github.com HookMgr]
###### License
This project is licensed under the LGPLv3 License
[Composer]:https://getcomposer.org/
[github.com HookMgr]:https://github.com/iCalcreator/HookMgr
Files (7)
File
Role
Description
src (1 file)
test (1 file)
autoload.php
Aux.
Auxiliary script
composer.json
Data
Auxiliary data
LICENCE
Lic.
License text
phpunit.xml
Data
Auxiliary data
README.md
Doc.
Documentation
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer
Version Control Unique User Downloads Download Rankings 100% Total: 81 This week: 0
All time: 10,102 This week: 660 
Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.