1. Go to this page and download the library: Download openapi-tools/gatherer 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/ */
openapi-tools / gatherer example snippets
use cebe\openapi\Reader;
use OpenAPITools\Configuration\Gathering;
use OpenAPITools\Configuration\Gathering\Schemas;
use OpenAPITools\Gatherer\Gatherer;
$representation = Gatherer::gather(
Reader::readFromYamlFile('openapi.yaml'),
new Gathering(
spec: 'openapi.yaml',
voter: null,
schemas: new Schemas(
allowDuplication: true,
useAliasesForDuplication: true,
),
),
);
use OpenAPITools\Gatherer\Schema;
use OpenAPITools\Registry\Contract;
use OpenAPITools\Registry\Schema as SchemaRegistry;
$schemaRegistry = new SchemaRegistry(allowDuplication: false, useAliasesForDuplication: false);
$contractRegistry = new Contract();
$schema = Schema::gather(
'User',
$openApiSchema,
$schemaRegistry,
$contractRegistry,
);