Updating docs to include basic data from the README

This commit is contained in:
Justin Rainbow 2011-12-10 15:49:29 -07:00
parent 7b13db0637
commit 615e9b8807
3 changed files with 31 additions and 0 deletions

View File

@ -1,5 +1,7 @@
# JSON Schema for PHP
Documentation can be found at http://jsonschema.readthedocs.org/
## Usage
```php

View File

@ -16,6 +16,9 @@
"email": "justin.rainbow@gmail.com"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": { "JsonSchema": "src/" }
}

View File

@ -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
==================