PHP code example of yoanm / jsonrpc-http-server-swagger-doc-sdk

1. Go to this page and download the library: Download yoanm/jsonrpc-http-server-swagger-doc-sdk 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/ */

    

yoanm / jsonrpc-http-server-swagger-doc-sdk example snippets


use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\ErrorDocNormalizer;
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\ExternalSchemaListDocNormalizer;
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\OperationDocNormalizer;
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\RequestDocNormalizer;
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\ResponseDocNormalizer;
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\SchemaTypeNormalizer;
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\ShapeNormalizer;
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\TypeDocNormalizer;
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Resolver\DefinitionRefResolver;
use Yoanm\JsonRpcHttpServerSwaggerDoc\Infra\Normalizer\DocNormalizer;

$shapeNormalizer = new ShapeNormalizer();
$definitionRefResolver = new DefinitionRefResolver();
$typeDocNormalizer = new TypeDocNormalizer(
    new SchemaTypeNormalizer()
);

$normalizer = new DocNormalizer(
    new ExternalSchemaListDocNormalizer(
        $definitionRefResolver,
        $typeDocNormalizer,
        new ErrorDocNormalizer(
            $typeDocNormalizer,
            $shapeNormalizer
        ),
        $shapeNormalizer
    ),
    new OperationDocNormalizer(
        $definitionRefResolver,
        new RequestDocNormalizer(
            $definitionRefResolver,
            $shapeNormalizer
        ),
        new ResponseDocNormalizer(
            $definitionRefResolver,
            $shapeNormalizer
        )
    )
);

use Yoanm\JsonRpcServerDoc\Domain\Model\ServerDoc;

$serverDoc = new ServerDoc();
// Configure server doc
...
// Add methods documentation
...
// Then normalize
/** @var array $swaggerDoc */
$swaggerDoc = $normalizer->normalize($serverDoc);