PHPackages                             lkt/hooks - 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. lkt/hooks

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

lkt/hooks
=========

LKT Hooks engine

1.0.1(3mo ago)0127MITPHPPHP &gt;=8.1.0

Since Jul 11Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/lkt-php/lkt-hooks)[ Packagist](https://packagist.org/packages/lkt/hooks)[ RSS](/packages/lkt-hooks/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

LKT Hooks
=========

[](#lkt-hooks)

Installation
============

[](#installation)

```
composer require lkt/hooks
```

Register hooks
==============

[](#register-hooks)

```
use Lkt\Hooks\Hook;

Hook::register('hook-name', 'hook-action', [callable])
```

For example:

```
use Lkt\Hooks\Hook;

Hook::register('create-user', 'mail-set-up-password', [callable])
Hook::register('create-user', 'mail-admin-new-user-created', [callable])
```

Every action can be registered as many times as you need. All results will be returned when triggered.

The only limitation it's all action handler must have the same method definition.

For example:

```
class HookStack {

    public static function mailPassword(int $userId, string $name, string $lastname): bool
    {
        // ... your stuff
        return true;
    }

    // If we want to define another method with different code,
    // the method must have the same arguments and return type.
    // This is a valid method:
    public static function mailPassword2(int $userId, string $name, string $lastname): bool
    {
        // ... another stuff
        return true;
    }

    // This is an invalid method:
    public static function mailPassword3(int $userId, string $name): bool
    {
        // ... third stuff
        return true;
    }
}
use Lkt\Hooks\Hook;

Hook::register('create-user', 'mail-set-up-password', [HookStack::class, 'mailPassword'])
Hook::register('create-user', 'mail-set-up-password', [HookStack::class, 'mailPassword2'])
Hook::register('create-user', 'mail-set-up-password', [HookStack::class, 'mailPassword3'])
```

Trigger a hook
==============

[](#trigger-a-hook)

```
use Lkt\Hooks\Hook;

Hook::run('hook-name', ...$args)
```

For example:

```
use Lkt\Hooks\Hook;

$id = 1;
$name = 'John';
$lastname = 'Doe';

$response = Hook::register('create-user', $id, $name, $lastname);
```

The previous example will return a `HookResponse` object containing the result of all triggers called.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance78

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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 ~926 days

Total

2

Last Release

116d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0915bfa65bb0c27057b7043d2b423137915e107411dd1684630508f2df076291?d=identicon)[lkt](/maintainers/lkt)

---

Top Contributors

[![alphaibanez](https://avatars.githubusercontent.com/u/24976472?v=4)](https://github.com/alphaibanez "alphaibanez (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lkt-hooks/health.svg)

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

###  Alternatives

[nikolaposa/version

Value Object that represents a SemVer-compliant version number.

1406.4M16](/packages/nikolaposa-version)[whatthejeff/nyancat-scoreboard

Nyan Cat Scoreboard

19985.0k4](/packages/whatthejeff-nyancat-scoreboard)[symfony/ux-swup

Swup integration for Symfony

33147.8k1](/packages/symfony-ux-swup)

PHPackages © 2026

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