A PHP CLI tool for JSON Schema
PHP
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
schema
src
tests
.editorconfig
.gitattributes
.gitignore
.scrutinizer.yml
.styleci.yml
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE.md
README.md
composer.json
json-guard
phpunit.xml.dist

README.md

json-guard-cli

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This package is a CLI client for JSON Guard, a JSON Schema validator. You can easily validate data against a schema or check your schema itself.

json-guard-cli-screenshot

Install

Installation uses Composer.

Project Install

$ composer require yuloh/json-guard-cli

Global Install

If you don't want to install this per project, you can install it globally and use it anywhere. If you aren't familiar with Composer's global install functionality, this tutorial should get you up and running.

$ composer global require yuloh/json-guard-cli

Usage

Validate

Validate Data Against a Schema.

Usage:

$ json-guard validate [<data>] [<schema>]

Arguments:

  • data: The data to validate.
  • schema: The schema to use.

Examples:

# Using files
$ json-guard validate my-data.json my-schema.json
# Using JSON strings
$ json-guard validate \
'{ "id": "https://json-guard.dev/schema#" }' \
'{ "properties": { "id": { "type": "string", "format": "uri" } } }'
# Loading Schema with a Loader
$ json-guard validate my-data.json 'http://json-schema.org/draft-04/schema#'

Check

Check that a JSON Schema is valid.

Usage:

$ json-guard check [<schema>]

Arguments:

  • schema: The schema to check.

Examples:

$ json-guard check my-schema.json

Loading JSON

All commands can load the JSON as a string, from a loader path, from a local file path, or from STDIN.

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

The MIT License (MIT). Please see License File for more information.