PHP code example of specdocular / php-json-schema

1. Go to this page and download the library: Download specdocular/php-json-schema library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

specdocular / php-json-schema example snippets


use Specdocular\JsonSchema\Draft202012\StrictFluentDescriptor;
use Specdocular\JsonSchema\Draft202012\Keywords\Properties\Property;

$schema = StrictFluentDescriptor::object()
    ->properties(
        Property::create('name', StrictFluentDescriptor::string()->minLength(1)),
        Property::create('email', StrictFluentDescriptor::string()->format('email')),
        Property::create('age', StrictFluentDescriptor::integer()->minimum(0)),
    )
    ->
bash
composer