PHPackages                             kigkonsult/hookmgr - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kigkonsult/hookmgr

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kigkonsult/hookmgr
==================

PHP hook callables manager

v1.4(4y ago)379LGPL-3.0-or-laterPHPPHP &gt;=8.0

Since Jun 7Pushed 4y ago2 watchersCompare

[ Source](https://github.com/iCalcreator/HookMgr)[ Packagist](https://packagist.org/packages/kigkonsult/hookmgr)[ Fund](https://paypal.me/kigkonsult)[ RSS](/packages/kigkonsult-hookmgr/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

> 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 );
```

###### Methods

[](#methods)

`HookMgr::addAction( hook, callable )`

- Add single hook with single callable, *syntax\_only* callable check
- `hook` *string*
- `callable` *callable*
- Throws InvalidArgumentException
- static

`HookMgr::addActions( hook, callables )`

- Add single hook invoking an array of callables
- Note, if invoked with arguments, arguments are used for all callables
- `hook` *string*
- `callables` *callable\[\]*
- Throws InvalidArgumentException
- static

`HookMgr::setActions( actions )`

- Set all hooks, each for invoking single or array of callables
- `actions` *array* \*( hook =&gt; callable(s) )
- Throws InvalidArgumentException
- static

---

`HookMgr::apply( hook [, args ] )`

- Invoke 'hook' action(s), return (last) result
- `hook` *string*
- `args` *array* opt, \[ arg1, arg2... \]
    - Opt arguments are used in all hook invokes
    - To use an argument by-reference, use `HookMgr::apply( 'hook', [ & $arg ] );`
- Return *mixed*
- Throws RuntimeException
- static

---

`HookMgr::count( hook )`

- Return count of callables for hook, not found return 0
- `hook` *string*
- Return bool
- static

`HookMgr::exists( hook )`

- Return bool true if hook is set
- `hook` *string*
- Return bool
- static

`HookMgr::getCallables( hook )`

- Return array callables for hook, not found return \[\]
- `hook` *string*
- Return *callable\[\]*
- static

`HookMgr::getHooks()`

- Return *array* (string\[\]) hooks
- static

`HookMgr::init()`

- Clear (remove) all hooks with callables
- static

`HookMgr::remove( hook )`

- Remove single hook with callable(s)
- `hook` *string*
- static

---

`HookMgr::toString()`

- Return *string* nice rendered hooks with callable(s)
- static

###### Sponsorship

[](#sponsorship)

Donation using [paypal.me/kigkonsult](https://paypal.me/kigkonsult?locale.x=en_US) are appreciated. For invoice, [please e-mail](mailto:ical@kigkonsult.se).

###### INSTALL

[](#install)

```
composer require kigkonsult/hookmgr:dev-master
```

Composer, in your `composer.json`:

```
{
    "require": {
        "kigkonsult/hookmgr": "dev-master"
    }
}
```

Version 1.4 supports PHP 8, 1.2 7.4, 1.1 7.0.

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

[](#support)

For support go to [github.com HookMgr](https://github.com/iCalcreator/HookMgr)

###### License

[](#license)

This project is licensed under the LGPLv3 License

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~74 days

Total

3

Last Release

1649d ago

PHP version history (3 changes)v1.0.6PHP &gt;=5.6

v1.1PHP ^7.0

v1.4PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/880bc63234680337791ded78ebb9a07cbe59101a67e4bf0184ef4a6d5a32e6e2?d=identicon)[kigsf](/maintainers/kigsf)

---

Top Contributors

[![iCalcreator](https://avatars.githubusercontent.com/u/991251?v=4)](https://github.com/iCalcreator "iCalcreator (9 commits)")

---

Tags

plugininvokecallablemanagerextensionHOOKadd-ons

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kigkonsult-hookmgr/health.svg)

```
[![Health](https://phpackages.com/badges/kigkonsult-hookmgr/health.svg)](https://phpackages.com/packages/kigkonsult-hookmgr)
```

###  Alternatives

[kartik-v/yii2-widget-colorinput

An enhanced Yii 2 widget encapsulating the HTML 5 color input (sub repo split from yii2-widgets)

324.8M10](/packages/kartik-v-yii2-widget-colorinput)[daixianceng/yii2-smser

Yii2 SMS extension

862.9k1](/packages/daixianceng-yii2-smser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
