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.1CI failing

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 3w 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 79% 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

1007d 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://avatars.githubusercontent.com/u/529819?v=4)[func0der](/maintainers/func0der)[@func0der](https://github.com/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

[magento/community-edition

Magento 2 (Open Source)

12.1k53.0k12](/packages/magento-community-edition)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

5.0k4.9k](/packages/shlinkio-shlink)[mezzio/mezzio-tooling

Migration and development tooling for Mezzio

191.2M22](/packages/mezzio-mezzio-tooling)[mezzio/mezzio

PSR-15 Middleware Microframework

3903.8M120](/packages/mezzio-mezzio)[mezzio/mezzio-skeleton

Laminas mezzio skeleton. Begin developing PSR-15 middleware applications in seconds!

12926.5k](/packages/mezzio-mezzio-skeleton)

PHPackages © 2026

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