PHPackages                             polus/adr-json-schema-input - 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. polus/adr-json-schema-input

ActiveLibrary

polus/adr-json-schema-input
===========================

Helper to create input validation based on json schema

1.0.0(7y ago)03MITPHPPHP &gt;=7.2.0

Since Jan 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/sunkan/json-schema-input)[ Packagist](https://packagist.org/packages/polus/adr-json-schema-input)[ RSS](/packages/polus-adr-json-schema-input/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (2)Used By (0)

JsonSchemaInput for Polus\\Adr
==============================

[](#jsonschemainput-for-polusadr)

Helper class to make it easier to use [JsonSchema's](https://json-schema.org/) to validate request input

Install
-------

[](#install)

```
composer require polus/adr-json-schema-input

```

Usage
-----

[](#usage)

### SchemaMap

[](#schemamap)

To use the abstract input class you need to implement a `SchemaMap` That will contains information about the schemas and a way to load them.

```
use Polus\JsonSchemaInput\SchemaMapInterface;

class SchemaMap implements SchemaMapInterface
{
	public const SCHEMA_NS = 'https://schema_ns/schemas/';

	public const TEST_SCHEMA = 'subDirectory/test.json';

	private const ALLOWED_SCHEMAS = [
		self::TEST_SCHEMA,
	];

	public function getDefaultNamespace(): string
	{
		return self::SCHEMA_NS;
	}

	/**
	 * @return string[]
	 */
	public function getSchemaPaths(): array
	{
		return [
			'path to where schemas are stored',
		];
	}

	public function exists(string $schema): bool
	{
		return in_array($schema, self::ALLOWED_SCHEMAS, true);
	}

	public function get(string $schema): string
	{
		if ($this->exists($schema)) {
			return self::SCHEMA_NS . $schema;
		}

		return '';
	}

	public function load(string $schema): ?array
	{
		foreach ($this->getSchemaPaths() as $path) {
			if (file_exists($path.'/'.$schema)) {
				return json_decode($path.'/'.$schema, true);
			}
		}
		return null
	}
}
```

### Input

[](#input)

```
use Psr\Http\Message\ServerRequestInterface;
use Polus\JsonSchemaInput\Input\AbstractJsonSchemaInput;

class TestInput extends AbstractJsonSchemaInput
{
	public function __invoke(ServerRequestInterface $request)
	{
		$body = $this->validate($request, SchemaMap::TEST_SCHEMA);

		return $body;
	}
}
```

If the validate fails it will throw DomainException with the JsonSchema error message

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2658d ago

### Community

Maintainers

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

### Embed Badge

![Health badge](/badges/polus-adr-json-schema-input/health.svg)

```
[![Health](https://phpackages.com/badges/polus-adr-json-schema-input/health.svg)](https://phpackages.com/packages/polus-adr-json-schema-input)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69333.0M114](/packages/algolia-algoliasearch-client-php)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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