PHPackages                             datto/json-rpc-validator - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. datto/json-rpc-validator

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

datto/json-rpc-validator
========================

Auth extension for JSON-RPC library

5.0.0(8y ago)312.0k↑233.3%2LGPL-3.0PHP

Since Dec 15Pushed 8y ago4 watchersCompare

[ Source](https://github.com/datto/php-json-rpc-validator)[ Packagist](https://packagist.org/packages/datto/json-rpc-validator)[ Docs](http://www.datto.com)[ RSS](/packages/datto-json-rpc-validator/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

JSON-RPC Endpoint Validator Extension
=====================================

[](#json-rpc-endpoint-validator-extension)

This is an annotation-based validation extension for the [php-json-rpc](https://github.com/datto/php-json-rpc) library. It validates the JSON-RPC API endpoints against well-defined constraints, e.g. type checking, regex checking, etc.

The library depends on [symfony/Validator](https://github.com/symfony/Validator), [doctrine/annotations](https://github.com/doctrine/annotations) as well as on [php-json-rpc-simple](https://github.com/datto/php-json-rpc-simple).

Examples
--------

[](#examples)

Annotate your API endpoint classes like this:

```
namespace Datto\API;

use Datto\JsonRpc\Validator\Validate;
use Symfony\Component\Validator\Constraints as Assert;

class Math
{
    /**
     * @Validate(fields={
     *   "a" = @Assert\Type(type="integer"),
     *   "b" = {
     *     @Assert\Type(type="integer"),
     *     @Assert\NotEqualTo(value="0"),
     *   }
     * })
     */
    public function divide($a, $b)
    {
        return $a / $b;
    }
```

Once you have that, just use it like this. This example uses the `Simple\Evaluator` (see [php-json-rpc-simple](https://github.com/datto/php-json-rpc-simple)) as underlying mapping mechanism:

```
$server = new Server(new Validator\Evaluator(new Simple\Evaluator()));
$result = $server->reply('{"jsonrpc": "2.0", "method": "math/divide", "params": { "a": 1, "b": 0 }, "id": 1}');

// Because 'b' cannot be 0, this will return
// {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"Invalid params"}}
```

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

[](#requirements)

- PHP &gt;= 5.3

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

[](#installation)

```
"require": {
  "datto/json-rpc-validator": "~2.0"
}
```

License
-------

[](#license)

This package is released under an open-source license: [LGPL-3.0](https://www.gnu.org/licenses/lgpl-3.0.html).

Author
------

[](#author)

Written by [Philipp C. Heckel](https://github.com/binwiederhier).

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 55.6% 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 ~734 days

Total

2

Last Release

3108d ago

Major Versions

4.0.0 → 5.0.02017-12-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb044681aa172ced7a03b093bda1f1f1031831133281d3d1e036807d28260c31?d=identicon)[datto-packagist-maintainer](/maintainers/datto-packagist-maintainer)

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

---

Top Contributors

[![binwiederhier](https://avatars.githubusercontent.com/u/664597?v=4)](https://github.com/binwiederhier "binwiederhier (5 commits)")[![mmeyer724](https://avatars.githubusercontent.com/u/977113?v=4)](https://github.com/mmeyer724 "mmeyer724 (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/datto-json-rpc-validator/health.svg)

```
[![Health](https://phpackages.com/badges/datto-json-rpc-validator/health.svg)](https://phpackages.com/packages/datto-json-rpc-validator)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M373](/packages/easycorp-easyadmin-bundle)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

51090.8k2](/packages/web-auth-webauthn-framework)[web-auth/webauthn-symfony-bundle

FIDO2/Webauthn Security Bundle For Symfony

65474.5k9](/packages/web-auth-webauthn-symfony-bundle)[oro/platform

Business Application Platform (BAP)

642140.7k104](/packages/oro-platform)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1155.2k](/packages/rcsofttech-audit-trail-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)

PHPackages © 2026

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