mirror of
https://github.com/justinrainbow/json-schema.git
synced 2025-01-17 21:28:20 +01:00
Updating docs to include basic data from the README
This commit is contained in:
parent
7b13db0637
commit
615e9b8807
@ -1,5 +1,7 @@
|
||||
# JSON Schema for PHP
|
||||
|
||||
Documentation can be found at http://jsonschema.readthedocs.org/
|
||||
|
||||
## Usage
|
||||
|
||||
```php
|
||||
|
@ -16,6 +16,9 @@
|
||||
"email": "justin.rainbow@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "JsonSchema": "src/" }
|
||||
}
|
||||
|
@ -12,6 +12,32 @@ Contents:
|
||||
:maxdepth: 2
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
git clone --recursive https://github.com/justinrainbow/json-schema.git
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
$validator = new JsonSchema\Validator();
|
||||
$result = $validator->validate(json_decode($json), json_decode($schema));
|
||||
|
||||
if ($result->valid) {
|
||||
echo "The supplied JSON validates against the schema.\n";
|
||||
} else {
|
||||
echo "JSON does not validate. Violations:\n";
|
||||
foreach ($result->errors as $error) {
|
||||
echo "[{$error['property']}] {$error['message']}\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
Loading…
x
Reference in New Issue
Block a user