PHPackages                             nahid/hookr - 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. nahid/hookr

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

nahid/hookr
===========

php hook system for binding any service in a action

v1.1.0(7y ago)423859MITPHPPHP &gt;=5.6

Since Jan 8Pushed 7y ago4 watchersCompare

[ Source](https://github.com/nahid/hookr)[ Packagist](https://packagist.org/packages/nahid/hookr)[ RSS](/packages/nahid-hookr/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

PHP hookr
=========

[](#php-hookr)

A PHP package for action and filter hook. Its helps to you fire any event with your desire action. Its a similar service as WP action and filter.

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

[](#installation)

Write these command from you terminal.

```
composer require nahid/hookr
```

Laravel Configuration
---------------------

[](#laravel-configuration)

After complete installation go to `config/app.php` and add this line in providers section

```
Nahid\Hookr\HookrServiceProvider::class,
```

and add this line in aliases section

```
'Hook'  =>  Nahid\Hookr\Facades\Hook::class,
```

Thats all

Usages
------

[](#usages)

Its so easy to use. Just follow the instruction and apply with your laravel project.

### Action

[](#action)

You want to extra control with your application without touching your code you apply Action. Suppose you have a blog editor panel. Where you want add extra buttons from others developer without rewrite your code. so lets see.

```

        Title

        Blog

    Publish
    {{hook_action('buttons')}}

```

[![Demo](https://camo.githubusercontent.com/88af22a780657e0a9ee67a39523cb3237cf192e6c0c84519402e41185149fe98/687474703a2f2f692e696d6775722e636f6d2f78714e316272712e706e67 "demo")](https://camo.githubusercontent.com/88af22a780657e0a9ee67a39523cb3237cf192e6c0c84519402e41185149fe98/687474703a2f2f692e696d6775722e636f6d2f78714e316272712e706e67)

See, here we use `hook_action()` helper function which is register as named `buttons`So if others developer is want to add more buttons with this form they will do this

```
use Nahid\Hookr\Facades\Hook;

class BlogController extends Controller
{
      public function getWritePost()
      {
          Hook::bindAction('buttons', function() {
              echo ' Draft';
          }, 2);

          return view('post');
     }
}
```

After run this code add new button will add with existing button.

[![Demo](https://camo.githubusercontent.com/68ef627de058bd31f167741cb5b8cb837948a6af306e7778fdcc6fae1f79f7c7/687474703a2f2f692e696d6775722e636f6d2f55647931546b472e706e67 "demo")](https://camo.githubusercontent.com/68ef627de058bd31f167741cb5b8cb837948a6af306e7778fdcc6fae1f79f7c7/687474703a2f2f692e696d6775722e636f6d2f55647931546b472e706e67)

You can also bind multiple action with this hook. Hookr also support filter. Remind this when you bind multiple filter in a hook then every filter get data from previous filters return data. Suppose you want to add a filter hook in a blog view section.

```
  {{$blog->title}}

  {{hook_filter('posts', $blog->content)}}

```

So we register a filter as 'posts'. Now another developer wants to support markdown for blog posts. so he can bind a filter for parse markdown.

```
 use Nahid\Hookr\Facades\Hook;

 class BlogController extends Controller
 {
       public function getPosts()
       {
           Hook::bindFilter('posts', function($data) {
               return parse_markdown($data);
           }, 2);

           return view('post');
      }
 }
```

Note: In filter, every callback function must have at least one param which is represent current data

so if you want to bind multiple data then

```
use Nahid\Hookr\Facades\Hook;

class BlogController extends Controller
{
     public function getPosts()
     {
         Hook::bindFilter('posts', function($data) {
             return parse_markdown($data);
         }, 2);

         Hook::bindFilter('posts', function($data) {
             return parse_bbcode($data);
         }, 3);

         return view('post');
    }
}
```

Now then given data is parse by markdown and bbcode. See, here is second param for `bindFilter()` is a priority for binding. Both `bindAction()` and `bindFilter()` has this feature.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

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

Total

2

Last Release

2909d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3167309?v=4)[Nahid Bin Azhar](/maintainers/nahid)[@nahid](https://github.com/nahid)

---

Top Contributors

[![nahid](https://avatars.githubusercontent.com/u/3167309?v=4)](https://github.com/nahid "nahid (8 commits)")

---

Tags

actionfilterhookhookrhookslaravelphp

### Embed Badge

![Health badge](/badges/nahid-hookr/health.svg)

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

###  Alternatives

[symfony/thanks

Encourages sending ⭐ and 💵 to fellow PHP package maintainers (not limited to Symfony components)!

8.1k16.3M296](/packages/symfony-thanks)[laminas/laminas-component-installer

Composer plugin for injecting modules and configuration providers into application configuration

304.4M107](/packages/laminas-laminas-component-installer)

PHPackages © 2026

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