PHPackages                             blessing/filter - 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. blessing/filter

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

blessing/filter
===============

Filters API for designing plugin system.

v1.4.0(11mo ago)03.7k↑58.3%1MITPHPCI failing

Since Dec 27Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/bs-community/filter)[ Packagist](https://packagist.org/packages/blessing/filter)[ RSS](/packages/blessing-filter/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (7)Used By (1)

filters
=======

[](#filters)

Filters API for designing and creating plugin system, within Laravel.

> We used this in Blessing Skin Server.

The "Filters API" is similar with Filters API of WordPress, but comes with different API. And this package is designed for Laravel, so it may not work if you use it without Laravel.

💿 Install
---------

[](#-install)

Run Composer:

```
composer require blessing/filter

```

🔨 Usage
-------

[](#-usage)

With Laravel's Auto-Discovery, you don't need to configure your Laravel application manually.

Currently this package doesn't provide Facade. You must get instance by using type-hint in your controllers or using global `resolve()` helper function.

For example:

```
use Blessing\Filter;

class MyController extends Controller
{
    public function home(Filter $filter)
    {
        //
    }
}
```

### Add a filter

[](#add-a-filter)

To add a filter for a specified hook, just call the `add` method:

```
$filter->add('hook_name', function ($value) {
    return $value;
});
```

Note that the filter handler must return a value; otherwise, the value after applied will be `null`.

You also can pass a class which has a public method called `filter` as handler.

```
class MyFilter
{
    public function filter($value)
    {
        return $value;
    }
}

$filter->add('hook_name', MyFilter::class);
// or
$filter->add('hook_name', 'MyFilter');
```

The class will be resolved from Laravel's service container, so you can use type-hint at the constructor of your class to resolve dependencies.

Additionally, you can specify the priority for your filter handler. Higher integer value indicates that it should come with higher priority.

Default priority is `20`.

```
$filter->add('hook_name', function ($value) {
    return $value;
}, 30);  // Higher than default priority.
```

### Apply a hook

[](#apply-a-hook)

You can call `apply` method to apply a hook:

```
$value = $filter->apply('hook_name', 'hi');
```

Then, the second argument you passed will be manipulated by filters.

Also, you can pass additional arguments as an array:

```
$value = $filter->apply('hook_name', 'hi', [$arg1, $arg2]);
```

Those additional arguments **won't** be manipulated by filters.

### Remove all filters

[](#remove-all-filters)

To remove all filters for a specified hook, just:

```
$filter->remove('hook_name');
```

### Totally...

[](#totally)

This is a full example:

```
$filter->add('hook_name', function ($value, $arg1, $arg2) {
    if ($arg1 === '...') {
        return $value;
    }

    return $value.'!';
});

$value = $filter->apply('hook_name', 'hi', ['abc', 'def']);
// You should get the text "hi!" here.
```

📄 License
---------

[](#-license)

MIT License (c) The Blessing Skin Team

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance50

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~402 days

Recently: every ~486 days

Total

6

Last Release

358d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11074155?v=4)[gplane](/maintainers/gplane)[@gplane](https://github.com/gplane)

![](https://avatars.githubusercontent.com/u/12845643?v=4)[Asnxthaony](/maintainers/Asnxthaony)[@Asnxthaony](https://github.com/Asnxthaony)

---

Top Contributors

[![g-plane](https://avatars.githubusercontent.com/u/17216317?v=4)](https://github.com/g-plane "g-plane (12 commits)")[![Asnxthaony](https://avatars.githubusercontent.com/u/12845643?v=4)](https://github.com/Asnxthaony "Asnxthaony (1 commits)")[![tnqzh123](https://avatars.githubusercontent.com/u/16630630?v=4)](https://github.com/tnqzh123 "tnqzh123 (1 commits)")

---

Tags

laravelwordpressfilters

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/blessing-filter/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

9782.1M161](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k239.9k75](/packages/moonshine-moonshine)[webwizo/laravel-shortcodes

Wordpress like shortcodes for Laravel 11, 12 and 13

217685.2k8](/packages/webwizo-laravel-shortcodes)[linkxtr/laravel-qrcode

A clean, modern, and easy-to-use QR code generator for Laravel

3614.9k](/packages/linkxtr-laravel-qrcode)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.2k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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