PHPackages                             func0der/ze-content-validation - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. func0der/ze-content-validation

ActiveLibrary[HTTP &amp; Networking](/categories/http)

func0der/ze-content-validation
==============================

PSR-7 Validation middleware for Laminas Mezzio

3.1.0(2y ago)05.1k1[4 issues](https://github.com/func0der/ze-content-validation/issues)MITPHPPHP ^8.1

Since Mar 6Pushed 2y agoCompare

[ Source](https://github.com/func0der/ze-content-validation)[ Packagist](https://packagist.org/packages/func0der/ze-content-validation)[ RSS](/packages/func0der-ze-content-validation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (22)Versions (14)Used By (0)

Mezzio Content Validation
=========================

[](#mezzio-content-validation)

[![CI-Test](https://github.com/func0der/ze-content-validation/actions/workflows/test.yml/badge.svg)](https://github.com/func0der/ze-content-validation/actions/workflows/test.yml)

Introduction main

`Mezzio Content Validation` (former `Zend Expressive Content Validation`) is a Mezzio middleware for automating validation of incoming input.

Allows the following:

- Defining named input filters.
- Mapping named input filters to routes.
- Returning a PSR-7 response representation of application/problem with validation error messages on invalid input using [Laminas Problem Details](https://github.com/mezzio/mezzio-problem-details)

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

[](#installation)

Run the following `composer` command:

```
$ composer require func0der/ze-content-validation
```

Configuration
=============

[](#configuration)

The ze-content-validation key is a mapping between routes names as the key, and the value being an array of mappings that determine which HTTP method to respond to and what input filter to map to for the given request. The keys for the mapping can either be an HTTP method or `*` wildcard for applying to any http method.

Example:

```
'ze-content-validation' => [
    'user.add' => [
        'POST' =>  \App\InputFilter\UserInputFilter::class
    ],
],
```

In the above example, the \\App\\InputFilter\\UserInputFilter will be selected for POST requests.

#### input\_filter\_spec

[](#input_filter_spec)

`input_filter_spec` is for configuration-driven creation of input filters. The keys for this array will be a unique name, but more often based off the service name it is mapped to under the `ze-content-validation` key. The values will be an input filter configuration array, as is described in the Laminas manual [section on input filters](https://docs.laminas.dev/laminas-inputfilter/intro/).

Example:

```
    'input_filter_specs' => [
        'App\\InputFilter\\LoginInputFilter' => [
            0 => [
                'name' => 'displayName',
                'required' => true,
                'filters' =>[],
                'validators' => [
                     0 => [
                        'name' => 'not_empty',
                     ]
                ],

            ],
            1 => [
                'name' => 'password',
                'required' => true,
                'filters' => [],
                'validators' => [
                    0 => [
                        'name' => 'not_empty',
                    ],
                    1 => [
                        'name' => 'string_length',
                        'options' => [
                            'min' => 8,
                            'max' => 12
                        ],
                    ],
                ],
            ],
        ],
    ],
```

### Validating

[](#validating)

In the following request, an email value is provided with an invalid format, and the displayName field is omitted entirely:

```
POST /users HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8

{
    "email": "foo",
    "password": "mySecretPassword!"

}
```

The response:

```
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/problem+json

{
  "detail": "Validation Failed",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "https://httpstatus.es/422",
  "errors": {
    "email": {
        "emailAddressInvalidFormat": "The input is not a valid email address. Use the basic format local-part@hostname"
    },
    "displayName": {
      "isEmpty": "Value is required and can't be empty"
    }
  },
}
```

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 52% 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 ~265 days

Recently: every ~491 days

Total

10

Last Release

962d ago

Major Versions

0.1.0 → 1.0.02017-05-09

1.1.0 → 2.0.02018-05-04

2.0.0 → 3.0.0-RC12021-10-20

PHP version history (5 changes)0.1.0PHP ^5.5 || ^7.0

2.0.0PHP ^7.1

3.0.0-RC1PHP ^7.4 || ^8.0

3.0.0PHP ^8.0

3.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/25044f1f00a2f6504bc764b149645dfa012e1e874f35cb0a52f24267db82297e?d=identicon)[func0der](/maintainers/func0der)

---

Top Contributors

[![func0der](https://avatars.githubusercontent.com/u/529819?v=4)](https://github.com/func0der "func0der (26 commits)")[![drigani](https://avatars.githubusercontent.com/u/1814689?v=4)](https://github.com/drigani "drigani (15 commits)")[![pascalheidmann-check24](https://avatars.githubusercontent.com/u/167064802?v=4)](https://github.com/pascalheidmann-check24 "pascalheidmann-check24 (6 commits)")[![pascalheidmann](https://avatars.githubusercontent.com/u/19560252?v=4)](https://github.com/pascalheidmann "pascalheidmann (2 commits)")[![slaff](https://avatars.githubusercontent.com/u/247452?v=4)](https://github.com/slaff "slaff (1 commits)")

---

Tags

hacktoberfesthttppsrpsr-7laminasvalidationmezzio

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/func0der-ze-content-validation/health.svg)

```
[![Health](https://phpackages.com/badges/func0der-ze-content-validation/health.svg)](https://phpackages.com/packages/func0der-ze-content-validation)
```

###  Alternatives

[mezzio/mezzio

PSR-15 Middleware Microframework

3883.6M97](/packages/mezzio-mezzio)[mezzio/mezzio-tooling

Migration and development tooling for Mezzio

191.1M21](/packages/mezzio-mezzio-tooling)[mezzio/mezzio-fastroute

FastRoute integration for Mezzio

162.7M52](/packages/mezzio-mezzio-fastroute)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.0M60](/packages/mezzio-mezzio-router)[laminas/laminas-psr7bridge

Bidirectional conversions between PSR-7 and laminas-http messages

117.9M18](/packages/laminas-laminas-psr7bridge)[mezzio/mezzio-helpers

Helper/Utility classes for Mezzio

134.3M67](/packages/mezzio-mezzio-helpers)

PHPackages © 2026

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