PHPackages                             dmamontov/restnormalizer - 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. dmamontov/restnormalizer

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

dmamontov/restnormalizer
========================

Normalization data for the transmission via 'Representational State Transfer'.

1.0.2(10y ago)118BSD-3-ClausePHPPHP &gt;=5.3.3

Since May 10Pushed 10y ago1 watchersCompare

[ Source](https://github.com/dmamontov/restnormalizer)[ Packagist](https://packagist.org/packages/dmamontov/restnormalizer)[ Docs](http://www.slobel.ru/)[ RSS](/packages/dmamontov-restnormalizer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/496f854e98ee89ccc55c09c04059ae8836a33b4760a60cfd688078be31b7f8b9/68747470733a2f2f706f7365722e707567782e6f72672f646d616d6f6e746f762f726573746e6f726d616c697a65722f762f737461626c652e737667)](https://packagist.org/packages/dmamontov/restnormalizer)[![License](https://camo.githubusercontent.com/d2325df27a9821b4a6847b33f1820cb3046302bcb9667448decbe3097efa1d3e/68747470733a2f2f706f7365722e707567782e6f72672f646d616d6f6e746f762f726573746e6f726d616c697a65722f6c6963656e73652e737667)](https://packagist.org/packages/dmamontov/restnormalizer)[![Total Downloads](https://camo.githubusercontent.com/c68c61310826266b0d26f15bf9891f9d495d7e4137b6b4bfbe7052dbd62f34bf/68747470733a2f2f706f7365722e707567782e6f72672f646d616d6f6e746f762f726573746e6f726d616c697a65722f646f776e6c6f616473)](https://packagist.org/packages/dmamontov/restnormalizer)

REST Normalizer
===============

[](#rest-normalizer)

This class can validate and filter parameters based on JSON rules.

It can take a list of request parameters passed as an array or as a JSON string and validates it according to rules defined in an external files in the JSON format.

The class can traverse the parameter data and check if the entries match the types and validation rules defined in the rules file for the specific type of request.

Invalid values may be discard and logged to a given log file.

The class may also call callback functions before and after the normalization process.

[More information](https://dmamontov.github.io/restnormalizer).

Requirements
------------

[](#requirements)

- PHP version &gt;5.0

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

[](#installation)

1. Install [composer](https://getcomposer.org/download/)
2. Follow in the project folder:

```
composer require dmamontov/restnormalizer ~1.0.2
```

In config `composer.json` your project will be added to the library `dmamontov/restnormalizer`, who settled in the folder `vendor/`. In the absence of a config file or folder with vendors they will be created.

If before your project is not used `composer`, connect the startup file vendors. To do this, enter the code in the project:

```
require 'path/to/vendor/autoload.php';
```

Data types and values to be formatted
-------------------------------------

[](#data-types-and-values-to-be-formatted)

#### The data type "string"

[](#the-data-type-string)

- required - Checking the mandatory values, accepts parameters (true, false)
- default - Default
- max - The maximum allowable length of the string
- min - The minimum allowable length of the string
- pad - Supplemented with the symbol (default: " ")

```
"example": {
        "type": "string",
        "required": false,
        "default": "example",
        "max": 15,
        "min": 4,
        "pad": "+"
}
```

#### The data type "int"

[](#the-data-type-int)

- required - Checking the mandatory values, accepts parameters (true, false)
- default - Default
- max - The maximum allowable value
- min - The minimum allowable value

```
"example": {
        "type": "int",
        "required": true,
        "default": 55,
        "max": 203,
        "min": 10
}
```

#### The data type "double"

[](#the-data-type-double)

- required - Checking the mandatory values, accepts parameters (true, false)
- default - Default
- max - The maximum allowable value
- min - The minimum allowable value
- decimals - The number of digits after the decimal point

```
"example": {
        "type": "double",
        "required": true,
        "default": 5,
        "max": 20.5,
        "min": 1.1,
        "decimals": 5
}
```

#### The data type "bool"

[](#the-data-type-bool)

- required - Checking the mandatory values, accepts parameters (true, false)
- default - Default

```
"example": {
        "type": "bool",
        "required": true,
        "default": true
}
```

#### The data type "datetime"

[](#the-data-type-datetime)

- required - Checking the mandatory values, accepts parameters (true, false)
- default - Default (default: "now")
- format - Date and time format

```
"example": {
        "type": "datetime",
        "required": true,
        "default": "now",
        "format": "Y-m-d H:i:s"
}
```

#### The data type "enum"

[](#the-data-type-enum)

- required - Checking the mandatory values, accepts parameters (true, false)
- default - Default
- values - An array of enumerated values

```
"example": {
        "type": "enum",
        "required": true,
        "default": 999,
        "values": [1, 5, 999]
    }
```

#### The data type "skip"

[](#the-data-type-skip)

```
"example": {
        "type": "skip"
}
```

Example of work
---------------

[](#example-of-work)

```
require_once 'RestNormalizer.php';
$n = new RestNormalizer();
$n->setValidation('you-valid.json')
  ->setLogFile('valid.log');

$data = array(
	'key1' => 'value1',
	'key2' => 'value2',
	'key3' => 'value3'
);
$data = $n->normalize($data)
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

3883d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

1.0.1PHP &gt;=5.3.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5955726?v=4)[Dmitry Mamontov](/maintainers/dmamontov)[@dmamontov](https://github.com/dmamontov)

---

Top Contributors

[![dmamontov](https://avatars.githubusercontent.com/u/5955726?v=4)](https://github.com/dmamontov "dmamontov (21 commits)")

---

Tags

normalizerestvalidate

### Embed Badge

![Health badge](/badges/dmamontov-restnormalizer/health.svg)

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

###  Alternatives

[zircote/swagger-php

Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations

5.3k132.9M468](/packages/zircote-swagger-php)[psr/link

Common interfaces for HTTP links

2.5k144.1M68](/packages/psr-link)[league/fractal

Handle the output of complex data structures ready for API output.

3.5k64.1M476](/packages/league-fractal)[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[lexik/jwt-authentication-bundle

This bundle provides JWT authentication for your Symfony REST API

2.6k58.7M210](/packages/lexik-jwt-authentication-bundle)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M233](/packages/nelmio-api-doc-bundle)

PHPackages © 2026

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