php-extended / php-json-schema-generator-object
A library that implements the php-extended/php-json-schema-generator-interface library
7.0.7
2024-12-08 18:16 UTC
Requires
- php: >=8.0
- php-extended/php-accept-language-object: ^7
- php-extended/php-email-address-object: ^7
- php-extended/php-file-object: ^7
- php-extended/php-http-client-factory-object: ^7
- php-extended/php-json-schema-generator-interface: ^7
- php-extended/php-json-schema-object: ^7
- php-extended/php-simple-cache-filesystem: ^7
- php-extended/php-simple-cache-logger: ^7
- php-extended/php-uuid-object: ^7
- php-extended/php-version-object: ^7
- psr/http-client: ^1
- psr/simple-cache: ^3
Requires (Dev)
README
A library that implements the php-extended/php-json-schema-generator-interface interface library.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.phar
from their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-json-schema-generator-object ^7
Basic Usage
This library may be used the following way :
use PhpExtended\JsonSchema\JsonSchemaFileGeneratorPhp74;
use PhpExtended\JsonSchema\JsonSchemaFileWriter;
use PhpExtended\JsonSchema\JsonSchemaProvider;
use PhpExtended\JsonSchema\NamespaceHolder;
/** @var $logger Psr\Logger\LoggerInterface */
$jsonSchemaProvider = new JsonSchemaProvider();
$jsonSchema = $jsonSchemaProvider->provideFromFile('</path/to/file/json-schema.json>');
$namespaces = new NamespaceHolder('NS\\Interfaces', 'NS\\Classes', 'NS\\Tests');
$generator = new JsonSchemaFileGeneratorPhp74($namespaces, 'interface/composer-package-name', 'classes/composer-package-name', 'tests/composer-package-name', $logger);
$fileCollection = $generator->generate($jsonSchema);
$fileWriter = new JsonSchemaFileWriter($logger, '/path/to/interfaces/src', '/path/to/classes/src', '/path/to/tests/src');
$fileWrite->write($fileCollection);
License
MIT (See license file).