PHPackages                             creativesofttechsolutions/laravelhooks - 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. creativesofttechsolutions/laravelhooks

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

creativesofttechsolutions/laravelhooks
======================================

Wordpress Like Hooks System Package For Laravel

v1.0.1(11mo ago)011MITPHPPHP ^8.2

Since Jun 14Pushed 11mo agoCompare

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

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

Laravel Custom Hook System
==========================

[](#laravel-custom-hook-system)

This documentation explains how to build and use a flexible and performant hook system in Laravel 12. It supports both **actions** and **filters**, similar to WordPress, and works across controllers, Livewire components, middleware, and modules.

---

🛠 Installation
--------------

[](#-installation)

To install the `creativesofttechsolutions/laravelhooks` package, use Composer:

```
composer require creativesofttechsolutions/laravelhooks
```

🧠 What Are Actions and Filters?
-------------------------------

[](#-what-are-actions-and-filters)

### 🔹 Actions

[](#-actions)

- Actions are event triggers.
- They allow you to **run additional code** when something happens (e.g., after user registration, after an order is placed).
- Actions do not modify any data — they just perform side effects.

```
hooks()->addAction('after_user_register', function ($user) {
    Log::info("New user: " . $user->email);
});
```

### 🔸 Filters

[](#-filters)

- Filters are used to **modify and return data**.
- They allow other parts of the application or plugins to intercept, change, or validate values before they are used.

```
hooks()->addFilter('post_title', function ($title) {
    return strtoupper($title);
});
```

🚀 Usage Examples
----------------

[](#-usage-examples)

### Triggering an action:

[](#triggering-an-action)

```
hooks()->doAction('after_user_register', $user);
```

### Adding an action (e.g., in a module):

[](#adding-an-action-eg-in-a-module)

```
hooks()->addAction('after_user_register', function ($user) {
    Log::info("User Registered: " . $user->email);
});
```

### Adding and using filters:

[](#adding-and-using-filters)

```
hooks()->addFilter('product_price', function ($price, $product) {
    return $product->discount ? $price * 0.9 : $price;
});

$price = hooks()->applyFilters('product_price', $originalPrice, $product);
```

---

📦 Where to Define Hooks in Modules
----------------------------------

[](#-where-to-define-hooks-in-modules)

In `Modules/YourModule/Providers/ModuleServiceProvider.php`:

```
public function boot(): void {
    hooks()->addAction('after_user_register', ...);
    hooks()->addFilter('modify_data', ...);
}
```

Or in a dedicated class like:

```
Modules/YourModule/Hooks/HookRegistrar.php
```

And load them like:

```
HookRegistrar::register();
```

---

⚙️ Using Hooks in Controllers, Livewire, Middleware
---------------------------------------------------

[](#️-using-hooks-in-controllers-livewire-middleware)

### In Controllers:

[](#in-controllers)

```
hooks()->doAction('after_order_created', $order);
```

### In Livewire Components:

[](#in-livewire-components)

```
$this->value = hooks()->applyFilters('modify_value', $this->value);
```

### In Middleware:

[](#in-middleware)

```
$request = hooks()->applyFilters('modify_request', $request);
```

---

✅ Best Practices
----------------

[](#-best-practices)

- Use meaningful, unique hook names.
- Actions for side effects, Filters for modifying data.
- Use classes instead of closures for better readability and testing.
- Avoid heavy operations inside hook callbacks.

---

This system brings WordPress-style flexibility to Laravel while preserving Laravel’s clean architecture. You can dynamically extend your app and let plugins interact with core logic cleanly.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance52

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

2

Last Release

331d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/84709cb56727bcf759bc23c2fc6cbf8efc8ec0bd456a61827ceeeda2bb3050be?d=identicon)[creativesofttechsolutions](/maintainers/creativesofttechsolutions)

---

Top Contributors

[![creativesofttechsolutions](https://avatars.githubusercontent.com/u/216281582?v=4)](https://github.com/creativesofttechsolutions "creativesofttechsolutions (2 commits)")

### Embed Badge

![Health badge](/badges/creativesofttechsolutions-laravelhooks/health.svg)

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

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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