ixnode/php-json-schema-validator

一个易于使用的PHP Json Schema验证器。

0.1.4 2023-09-16 21:42 UTC

This package is auto-updated.

Last update: 2024-09-16 23:58:16 UTC


README

Release PHP PHPStan PHPUnit PHPCS PHPMD Rector - Instant Upgrades and Automated Refactoring LICENSE

基于opis/json-schema的一个易于使用的PHP Json Schema验证器。

1. 使用方法

use Ixnode\PhpJsonSchemaValidator\Validator;
$data = '[1, 2, 3]';

$schema = [
    'type' => 'object'
];

$validator = new Validator(new Json($data), new Json($schema));

$valid = $validator->validate();
// (bool) true

2. 安装

composer require ixnode/php-json-schema-validator
vendor/bin/php-json-schema-validator -V
php-json-schema-validator 0.1.0 (12-31-2022 15:51:08) - Björn Hempel <bjoern@hempel.li>

3. 库开发

git clone git@github.com:ixnode/php-json-schema-validator.git && cd php-json-schema-validator
composer install
composer test

4. 许可证

本工具遵循MIT许可证 - 详细内容请参阅LICENSE文件。