PHPackages                             masterbroki/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. [Database &amp; ORM](/categories/database)
4. /
5. masterbroki/hookable

ActiveLibrary[Database &amp; ORM](/categories/database)

masterbroki/hookable
====================

Laravel Eloquent hooks system.

v10.0.4(2y ago)0311MITPHPPHP ^8.0

Since May 21Pushed 2y agoCompare

[ Source](https://github.com/MasterBroki/hookable)[ Packagist](https://packagist.org/packages/masterbroki/hookable)[ RSS](/packages/masterbroki-hookable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (1)

Sofa/Hookable
=============

[](#sofahookable)

[![GitHub Tests Action Status](https://github.com/jarektkaczyk/hookable/workflows/Tests/badge.svg)](https://github.com/jarektkaczyk/hookable/actions?query=workflow%3Atests+branch%3Amaster) [![stable](https://camo.githubusercontent.com/2a86dcf9649a4049532d6244ef1e29ae075a4b0f67818a545ba540fff3b1bc9a/68747470733a2f2f706f7365722e707567782e6f72672f736f66612f686f6f6b61626c652f762f737461626c652e737667)](https://packagist.org/packages/sofa/hookable) [![Downloads](https://camo.githubusercontent.com/4150d2506de3a47f2e5c82e5598d939efb515366a4e4705f3b1d22feadf0c3dd/68747470733a2f2f706f7365722e707567782e6f72672f736f66612f686f6f6b61626c652f646f776e6c6f616473)](https://packagist.org/packages/sofa/hookable)

This is a overhaul of the Hookable system from jarektkaczyk/hookable to support laravel 10 and make the system leaner.

Hooks system for the [Eloquent ORM (Laravel 10.0)](https://laravel.com/docs/5.2/eloquent).

Hooks are available for the following methods:

- `Model::getAttribute`
- `Model::setAttribute`
- `Model::save`
- `Model::toArray`
- `Model::replicate`
- `Model::isDirty`
- `Model::__isset`
- `Model::__unset`

and all methods available on the `Illuminate\Database\Eloquent\Builder` class.

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

[](#installation)

Clone the repo or pull as composer dependency:

```
composer require masterbroki/hookable:~10.0

```

Usage
-----

[](#usage)

Use the hookable trait on the model:

```
class MyModel extends \Illuminate\Database\Eloquent\Model{
    use Sofa\Hookable\Hookable;
}
```

In order to register a hook, use the static method `hook` on the model:

```
MyModel::hook('myMethod', function($myParams){
    return "I want to select: " . implode(', ', $myParams);
});
```

And when the attribute is called:

```
$result = MyModel::select(["first", "second"]);

// $result will equal "I want to select: first, second"
```

Contribution
------------

[](#contribution)

All contributions are welcome, PRs must be **tested**.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55% 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 ~2 days

Total

5

Last Release

1085d ago

Major Versions

v1.0.0 → v10.0.02023-05-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/42c0a9c91fccb854814ad8be097ae6a9b2c11a1eb0191b25c60b3913bdfe4f90?d=identicon)[MasterBroki](/maintainers/MasterBroki)

---

Top Contributors

[![jarektkaczyk](https://avatars.githubusercontent.com/u/6928818?v=4)](https://github.com/jarektkaczyk "jarektkaczyk (33 commits)")[![MasterBroki](https://avatars.githubusercontent.com/u/21011120?v=4)](https://github.com/MasterBroki "MasterBroki (14 commits)")[![EricTendian](https://avatars.githubusercontent.com/u/498525?v=4)](https://github.com/EricTendian "EricTendian (3 commits)")[![boukeversteegh](https://avatars.githubusercontent.com/u/53926?v=4)](https://github.com/boukeversteegh "boukeversteegh (3 commits)")[![mewebstudio](https://avatars.githubusercontent.com/u/2125733?v=4)](https://github.com/mewebstudio "mewebstudio (2 commits)")[![salkhwlani](https://avatars.githubusercontent.com/u/10876587?v=4)](https://github.com/salkhwlani "salkhwlani (1 commits)")[![itsjavi](https://avatars.githubusercontent.com/u/122741?v=4)](https://github.com/itsjavi "itsjavi (1 commits)")[![jonruttan](https://avatars.githubusercontent.com/u/2718602?v=4)](https://github.com/jonruttan "jonruttan (1 commits)")[![kajetan-nobel](https://avatars.githubusercontent.com/u/3430519?v=4)](https://github.com/kajetan-nobel "kajetan-nobel (1 commits)")[![Remo](https://avatars.githubusercontent.com/u/129864?v=4)](https://github.com/Remo "Remo (1 commits)")

---

Tags

laraveleloquent

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

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