https://github.com/ergebnis/json-schema-validator
📃 Provides a composer package with a JSON schema validator, building on top of justinrainbow/json-schema.
https://github.com/ergebnis/json-schema-validator
json schema validator
Last synced: 11 months ago
JSON representation
📃 Provides a composer package with a JSON schema validator, building on top of justinrainbow/json-schema.
- Host: GitHub
- URL: https://github.com/ergebnis/json-schema-validator
- Owner: ergebnis
- License: mit
- Created: 2021-02-02T09:58:55.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-06-23T18:05:28.000Z (about 1 year ago)
- Last Synced: 2025-07-20T00:10:07.389Z (11 months ago)
- Topics: json, schema, validator
- Language: PHP
- Size: 3.04 MB
- Stars: 34
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# json-schema-validator
[](https://github.com/ergebnis/json-schema-validator/actions)
[](https://github.com/ergebnis/json-schema-validator/actions)
[](https://github.com/ergebnis/json-schema-validator/actions)
[](https://github.com/ergebnis/json-schema-validator/actions)
[](https://codecov.io/gh/ergebnis/json-schema-validator)
[](https://packagist.org/packages/ergebnis/json-schema-validator)
[](https://packagist.org/packages/ergebnis/json-schema-validator)
[](https://packagist.org/packages/ergebnis/json-schema-validator)
This project provides a [`composer`](https://getcomposer.org) package with a JSON schema validator, building on top of [`justinrainbow/json-schema`](https://github.com/justinrainbow/json-schema).
## Installation
Run
```sh
composer require ergebnis/json-schema-validator
```
## Usage
If you have used the validator from `justinrainbow/json-schema` before, you might have observed that it has a few flaws:
- The validator is stateful.
- The validator requires decoding JSON strings before validating them.
- The validator returns an `array` of errors, where each error is an `array`.
This package delegates the validation to `justinrainbow/json-schema` and provides a friendlier interface.
```php
validate(
$json,
$schema,
$jsonPointer
);
var_dump($result->isValid()); // bool
var_dump($result->errors()); // flat list of `ValidationError` value objects
```
## Changelog
The maintainers of this project record notable changes to this project in a [changelog](CHANGELOG.md).
## Contributing
The maintainers of this project suggest following the [contribution guide](.github/CONTRIBUTING.md).
## Code of Conduct
The maintainers of this project ask contributors to follow the [code of conduct](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).
## General Support Policy
The maintainers of this project provide limited support.
You can support the maintenance of this project by [sponsoring @ergebnis](https://github.com/sponsors/ergebnis).
## PHP Version Support Policy
This project supports PHP versions with [active and security support](https://www.php.net/supported-versions.php).
The maintainers of this project add support for a PHP version following its initial release and drop support for a PHP version when it has reached the end of security support.
## Security Policy
This project has a [security policy](.github/SECURITY.md).
## License
This project uses the [MIT license](LICENSE.md).
## Social
Follow [@localheinz](https://twitter.com/intent/follow?screen_name=localheinz) and [@ergebnis](https://twitter.com/intent/follow?screen_name=ergebnis) on Twitter.