PHPackages                             mvlabs/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. mvlabs/ze-content-validation

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

mvlabs/ze-content-validation
============================

PSR-7 Validation middleware for Zend Expressive

2.0.0(8y ago)82.0k8[3 issues](https://github.com/mvlabs/ze-content-validation/issues)[4 PRs](https://github.com/mvlabs/ze-content-validation/pulls)MITPHPPHP ^7.1

Since Mar 6Pushed 2y ago2 watchersCompare

[ Source](https://github.com/mvlabs/ze-content-validation)[ Packagist](https://packagist.org/packages/mvlabs/ze-content-validation)[ RSS](/packages/mvlabs-ze-content-validation/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (22)Versions (7)Used By (0)

Zend Expressive Content Validation
==================================

[](#zend-expressive-content-validation)

[![Build Status](https://camo.githubusercontent.com/49634ba3e68f3da4ce021997519a7120f724b7427284559b00356b4ecea526a4/68747470733a2f2f7472617669732d63692e6f72672f6d766c6162732f7a652d636f6e74656e742d76616c69646174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mvlabs/ze-content-validation)

Introduction
------------

[](#introduction)

Zend Expressive Content Validation is a 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 [Zend Problem Details](https://github.com/zendframework/zend-problem-details)

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

[](#installation)

Run the following `composer` command:

```
$ composer require mvlabs/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 ZF2 manual [section on input filters](http://zf2.readthedocs.org/en/latest/modules/zend.input-filter.intro.html).

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

32

—

LowBetter than 69% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 93.8% 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 ~84 days

Recently: every ~89 days

Total

6

Last Release

2979d ago

Major Versions

0.1.0 → 1.0.02017-05-09

1.1.0 → 2.0.02018-05-04

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

2.0.0PHP ^7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1814689?v=4)[Diego Drigani](/maintainers/drigani)[@drigani](https://github.com/drigani)

---

Top Contributors

[![drigani](https://avatars.githubusercontent.com/u/1814689?v=4)](https://github.com/drigani "drigani (15 commits)")[![slaff](https://avatars.githubusercontent.com/u/247452?v=4)](https://github.com/slaff "slaff (1 commits)")

---

Tags

inputfiltermiddlewaremiddlewaresphppsr-15validationszend-expressivehttppsrpsr-7validationzendexpressive

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psr/http-message

Common interface for HTTP messages

7.0k1.1B6.5k](/packages/psr-http-message)[psr/http-factory

PSR-17: Common interfaces for PSR-7 HTTP message factories

1.9k728.6M2.5k](/packages/psr-http-factory)[laminas/laminas-diactoros

PSR HTTP Message implementations

548112.0M1.1k](/packages/laminas-laminas-diactoros)[fig/http-message-util

Utility classes and constants for use with PSR-7 (psr/http-message)

39394.6M298](/packages/fig-http-message-util)[psr/http-server-handler

Common interface for HTTP server-side request handler

179109.8M1.1k](/packages/psr-http-server-handler)[psr/http-server-middleware

Common interface for HTTP server-side middleware

18499.3M1.8k](/packages/psr-http-server-middleware)

PHPackages © 2026

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