1. Go to this page and download the library: Download jojo1981/json-schema-asg 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/ */
jojo1981 / json-schema-asg example snippets
/**
* @param ReferenceNode $referenceNode
* @return mixed
*/
public function visitReferenceNode(ReferenceNode $referenceNode)
{
if (!$referenceNode->isCircular()) {
$referenceNode->getPointToSchema()->accept($this);
}
}
maResolverFactory = new Jojo1981\JsonSchemaAsg\SchemaResolverFactory();
$schemaResolver = $schemaResolverFactory->getSchemaResolver();
// Example local files
$schemaFilenames = [
'resources/schemas/address.schema.json',
'resources/schemas/calendar.schema.json',
'resources/schemas/card.schema.json',
'resources/schemas/customer.schema.json',
'resources/schemas/geographical-location.schema.json'
];
foreach ($schemaFilenames as $relativeSchemaFilename) {
$absoluteSchemaFilename = \realpath($relativeSchemaFilename);
$reference = new Jojo1981\JsonSchemaAsg\Value\Reference($absoluteSchemaFilename . '#/');
$schema = $schemaResolver->resolveSchema($reference);
}
// Example urls
$schemaUrls = [
'https://raw.githubusercontent.com/jojo1981/json-schema-asg/master/resources/schemas/address.schema.json',
'https://raw.githubusercontent.com/jojo1981/json-schema-asg/master/resources/schemas/calendar.schema.json',
'https://raw.githubusercontent.com/jojo1981/json-schema-asg/master/resources/schemas/card.schema.json',
'https://raw.githubusercontent.com/jojo1981/json-schema-asg/master/resources/schemas/customer.schema.json',
'https://raw.githubusercontent.com/jojo1981/json-schema-asg/master/resources/schemas/geographical-location.schema.json'
];
foreach ($schemaUrls as $schemaUrl) {
$reference = new Jojo1981\JsonSchemaAsg\Value\Reference($schemaUrl . '#/');
$schema = $schemaResolver->resolveSchema($reference);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.