PHPackages                             shohel/pluggable - 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. shohel/pluggable

ActiveLibrary

shohel/pluggable
================

Add actions/filters hook to make your Laravel | Codeigniter | PHP project extensible

1.0.0(5y ago)16091MITPHPPHP &gt;=5.4

Since May 31Pushed 5y ago1 watchersCompare

[ Source](https://github.com/shohel/pluggable)[ Packagist](https://packagist.org/packages/shohel/pluggable)[ RSS](/packages/shohel-pluggable/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

> If you like this library, place star ⭐ at this repository and my profile please.

Pluggable
=========

[](#pluggable)

With Pluggable, you can register your actions hooks filter hooks to your PHP Project like WordPress, no matter it's raw PHP project / Laravel / Codeigniter / Moodle LMS / or any others. This is a library that allows you to make your PHP project so extensible.

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

[](#installation)

Use \[Composer\] to install the package:

```
$ composer require shohel/pluggable

```

Integration in Laravel
----------------------

[](#integration-in-laravel)

Pluggable has great support for Laravel and comes with a Service Provider for easy integration. The vendor/autoload.php is included by Laravel, so you don't have to require or autoload manually. Just see the instructions below.

After you have installed Pluggable, open your Laravel config file **`config/app.php`** and add the following lines.

In the $providers array add the service providers for this package as the very first item.

```
\Shohel\Pluggable\PluggableServiceProvider::class,
```

Now the Pluggable will be auto-loaded by Laravel.

Integration in Any other PHP Project
------------------------------------

[](#integration-in-any-other-php-project)

Include composer autoload file to your project before bootsrap / entry point.

```
// include composer autoload
require 'vendor/autoload.php';

// import the Pluggable HookManager Class
use Shohel\Pluggable\HookManager;

// create a hook manager instance, composer will do rest
$hookManager = new HookManager();
```

Pluggable will do the rest.

Usage
-----

[](#usage)

#### Action Hook

[](#action-hook)

`do_action( string $tag, mixed $arg )`

Execute functions hooked on a specific action hook.

This function invokes all functions attached to action hook $tag. It is possible to create new action hooks by simply calling this function, specifying the name of the new hook using the $tag parameter.

Example usage:

```
// The action callback function.
function example_callback( $arg1, $arg2 ) {
    // (maybe) do something with the args.
}
add_action( 'example_action', 'example_callback', 10, 2 );

/*
 * Trigger the actions by calling the 'example_callback()' function
 * that's hooked onto `example_action` above.
 *
 * - 'example_action' is the action hook.
 * - $arg1 and $arg2 are the additional arguments passed to the callback.
$value = do_action( 'example_action', $arg1, $arg2 );
```

#### Flter Hook

[](#flter-hook)

`apply_filters( string $tag, mixed $value )`

Calls the callback functions that have been added to a filter hook.

The callback functions attached to the filter hook are invoked by calling this function. This function can be used to create a new filter hook by simply calling this function with the name of the new hook specified using the $tag parameter.

Example usage:

```
// The filter callback function.
function example_callback( $string, $arg1, $arg2 ) {
    // (maybe) modify $string.
    return $string;
}
add_filter( 'example_filter', 'example_callback', 10, 3 );

/*
 * Apply the filters by calling the 'example_callback()' function
 * that's hooked onto `example_filter` above.
 *
 * - 'example_filter' is the filter hook.
 * - 'filter me' is the value being filtered.
 * - $arg1 and $arg2 are the additional arguments passed to the callback.
$value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 );
```

#### Hooks call back from the class

[](#hooks-call-back-from-the-class)

You can reference a class method to hooks callback instead of function, use `['className','callbackMethod']` or use it within a class. `[$this,'getStuffDone'] `

Here is a better way of doing it:

```
class MyClass {
     function __construct() {
          add_action( 'example_action',array( $this, 'callbackMethod' ) );
     }
     function callbackMethod() {
          // .. This is where stuff gets done ..
     }
}
$var = new MyClass();
```

As the hooks will work exactly like WordPress, you can read more about action hooks / filter hooks to WordPress.org documentation.

[Action Hooks](https://developer.wordpress.org/plugins/hooks/actions/) | [Filter Hooks](https://developer.wordpress.org/plugins/hooks/filters/)

> If you like this library, place star ⭐ at this repository and my profile please.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

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

Unknown

Total

1

Last Release

2175d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f69f67c24cb1944a35b52f07d78ed47c0e90992c3939532afd7fcca0afbcb222?d=identicon)[mhshohel](/maintainers/mhshohel)

---

Top Contributors

[![shohel](https://avatars.githubusercontent.com/u/10257621?v=4)](https://github.com/shohel "shohel (6 commits)")

### Embed Badge

![Health badge](/badges/shohel-pluggable/health.svg)

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

PHPackages © 2026

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