PHPackages                             mtymek/blast-input-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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. mtymek/blast-input-filter

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

mtymek/blast-input-filter
=========================

Configuration-based setup of zend-validator, zend-filter and zend-inputfilter for Expressive applications.

1.0.0(9y ago)34.5kBSD-2-ClausePHP

Since May 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mtymek/blast-input-filter)[ Packagist](https://packagist.org/packages/mtymek/blast-input-filter)[ RSS](/packages/mtymek-blast-input-filter/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (5)Versions (5)Used By (0)

Blast\\InputFilter
==================

[](#blastinputfilter)

[![Build Status](https://camo.githubusercontent.com/9d821cafa737bc9dd05a13280731fa07fe33acf842420d9574937b396665d528/68747470733a2f2f7472617669732d63692e6f72672f6d74796d656b2f626c6173742d696e7075742d66696c7465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mtymek/blast-input-filter)

**Configuration-based setup of `zend-validator`, `zend-filter` and `zend-inputfilter` for Zend Expressive applications.**

This package provides factories that allow to define custom filters and validators using configuration:

```
return [
    'filters' => [
        'factories' => [
            'Foo' => FooFilterFactory::class,
        ],
    ],
    'validators' => [
        'factories' => [
            'Bar' => BarValidatorFactory::class,
        ],
    ],
];
```

Later on they can be used directly when building an input filter:

```
$filter = $factory->createInputFilter(
    [
        [
            'name' => 'name',
            'filters' => [
                ['name' => 'Foo'],
            ],
            'validators' => [
                ['name' => 'Bar'],
            ],
        ],
    ]
);

return $filter;
```

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

[](#installation)

This package supports installation with composer:

```
$ composer require mtymek/blast-input-filter

```

Usage
-----

[](#usage)

### Define your custom filters and validators

[](#define-your-custom-filters-and-validators)

`blast-inputfilter` allows to set-up respective plugin managers using `filters`and `validators` keys:

```
return [
    'filters' => [
        'factories' => [
            'Foo' => FooFilterFactory::class,
        ],
    ],
    'validators' => [
        'factories' => [
            'Bar' => BarValidatorFactory::class,
        ],
    ],
];
```

This works exaclty like when using `zend-mvc`, only without performance penalty of ZF's module manager.

### Create input filter

[](#create-input-filter)

There are couple of ways of creating input filter and injecting it with elements. One of them is to use `__construct` method to create all inputs and specify validators:

```
namespace App\InputFilter;

use Zend\InputFilter\InputFilter;

class ContactInputFilter extends InputFilter
{
    public function __construct()
    {
        $this->add(
            [
                'name' => 'name',
                'filters' => [
                    ['name' => 'Foo'],
                ],
                'validators' => [
                    ['name' => 'Bar'],
                ],
            ]
        );

        $this->add(
            [
                'name' => 'content',
                'filters' => [
                    ['name' => 'StringTrim'],
                ],
            ]
        );
    }
}
```

### Create factory for your filter

[](#create-factory-for-your-filter)

In order for custom filters and validators to work, you need to pull `Zend\InputFilter\Factory`from service container and inject it into your input filter:

```
namespace App\InputFilter;

use Interop\Container\ContainerInterface;
use Zend\InputFilter\Factory;

class ContactInputFilterFactory
{
    public function __invoke(ContainerInterface $container)
    {
        $inputFilter = new ContactForm();
        $inputFilter->setFactory($container->get(Factory::class));
        return $inputFilter;
    }
}
```

Please note that you can use more generic factory to instantiate more input filters:

```
namespace App\InputFilter;

use Interop\Container\ContainerInterface;
use Zend\InputFilter\Factory;

class InputFilterFactory
{
    public function __invoke(ContainerInterface $container, $requestedName)
    {
        $inputFilter = new $requestedName();
        $inputFilter->setFactory($container->get(Factory::class));
        return $inputFilter;
    }
}
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Total

3

Last Release

3332d ago

Major Versions

0.1.1 → 1.0.02017-05-15

### Community

Maintainers

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

---

Top Contributors

[![mtymek](https://avatars.githubusercontent.com/u/777893?v=4)](https://github.com/mtymek "mtymek (20 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mtymek-blast-input-filter/health.svg)

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

###  Alternatives

[stroker/form

ZF2 module for extending forms with live clientside validation

3957.1k](/packages/stroker-form)[chaoswey/taiwan-id-validator

台灣身分證、統一編號驗證

319.9k](/packages/chaoswey-taiwan-id-validator)

PHPackages © 2026

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