PHPackages                             saschaende/laravel-hookable - 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. saschaende/laravel-hookable

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

saschaende/laravel-hookable
===========================

The WordPress filter/action system in Laravel

1.0.5(6mo ago)033MITPHPPHP &gt;=8.0

Since Oct 24Pushed 6mo agoCompare

[ Source](https://github.com/saschaende/laravel-hookable)[ Packagist](https://packagist.org/packages/saschaende/laravel-hookable)[ Docs](https://github.com/saschaende/laravel-hookable)[ RSS](/packages/saschaende-laravel-hookable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)DependenciesVersions (5)Used By (0)

Laravel Hookable
================

[](#laravel-hookable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/21b96c1f8f5090db6b9036d344963fcfa5f03a98f981e2c6b3747fd803276297/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736173636861656e64652f6c61726176656c2d686f6f6b61626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/saschaende/laravel-hookable)

Laravel Hookable is a package that allows you to use hooks (actions and filters) in Laravel applications – similar to the hook system in WordPress.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require saschaende/laravel-hookable
```

The package is automatically registered by Laravel (see `composer.json`).

How it works
------------

[](#how-it-works)

- **Actions**: Execute code without modifying data (e.g., for events or extensions).
- **Filters**: Allow modification of data.

The package provides a `Hookable` facade that exposes the main methods. The binding is handled automatically via the ServiceProvider.

Usage
-----

[](#usage)

### Adding actions

[](#adding-actions)

```
use SaschaEnde\Hookable\Facades\Hookable;

Hookable::action('my_action', function ($arg1, $arg2) {
    // Do something with $arg1 and $arg2
});
```

To execute the action (e.g., at a specific point in your code):

```
Hookable::renderActions('my_action', $arg1, $arg2);
```

### Adding filters

[](#adding-filters)

```
use SaschaEnde\Hookable\Facades\Hookable;

Hookable::filter('my_filter', function ($value) {
    // Modify $value
    return $value;
});
```

Apply the filter:

```
$value = Hookable::applyFilters('my_filter', $value);
```

### Priorities and arguments

[](#priorities-and-arguments)

You can specify the priority and the number of arguments for hooks:

```
Hookable::action('my_action', function ($arg1, $arg2) {
    // Do something
}, 20);
```

In this example, the action will be executed with priority 20 and will receive 2 arguments.

Blade Directives
----------------

[](#blade-directives)

The package registers two Blade directives to use hooks directly in Blade templates:

```
@applyFilter('my_filter', $value)
@doAction('my_action', $arg1, $arg2)
```

- `@applyFilter('filter_name', $value)`: Applies a filter to a value and outputs the result.
- `@doAction('action_name', ...)`: Executes an action and outputs its result.

Testing
-------

[](#testing)

You can run the tests using PHPUnit:

```
vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please submit a pull request or open an issue on GitHub.

License
-------

[](#license)

This package is open-source software licensed under the MIT license.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance66

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Total

4

Last Release

197d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/242f249e04e11c47fb07952e7f2cff6d6e3c9b3e727f8e6b8b2b8db4dfd7612c?d=identicon)[saschaende](/maintainers/saschaende)

---

Top Contributors

[![saschaende](https://avatars.githubusercontent.com/u/17617037?v=4)](https://github.com/saschaende "saschaende (16 commits)")

---

Tags

eventlaravelwordpresseventsfilterhooksHOOKfiltersactionsaction

### Embed Badge

![Health badge](/badges/saschaende-laravel-hookable/health.svg)

```
[![Health](https://phpackages.com/badges/saschaende-laravel-hookable/health.svg)](https://phpackages.com/packages/saschaende-laravel-hookable)
```

###  Alternatives

[tormjens/eventy

The WordPress filter/action system in Laravel

438912.9k16](/packages/tormjens-eventy)[millat/laravel-hooks

The WordPress filter, action system in Laravel

5715.1k](/packages/millat-laravel-hooks)[x-wp/di

The dependency injection container for WordPress

301.1k10](/packages/x-wp-di)

PHPackages © 2026

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