PHP Classes

File: Examples/HelloWorld/public/index.php

Recommend this page to a friend!
  Classes of Virgilio lino   PHP OpenAPI Library   Examples/HelloWorld/public/index.php   Download  
File: Examples/HelloWorld/public/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP OpenAPI Library
Implement APIs defined using OpenAPI specification
Author: By
Last change:
Date: 4 years ago
Size: 743 bytes
 

Contents

Class file image Download
<?php
require 'vendor/autoload.php';
$app = new \Slim\App;
$container = $app->getContainer();
//your command Handlers need to be injected by operationId
$container['HelloWorld'] = function () {
    return new \
HelloWorld\CommandHandlers\HelloWorld();
};
$openApiFile = 'routes.json';
$openApiConfigParser = Dispatcher\OpenApi\ParserFactory::parserFor($openApiFile);
$openApiConfig = $openApiConfigParser->parse($openApiFile);
$applicationBridge = new \Sab\Application\Bridge\SlimBridge($app);
$routesInjector = new \Dispatcher\OpenApi\Route\DefaultRouteInjector();
$openApiDispatcher = new \Dispatcher\OpenApi\OpenApiDispatcher($routesInjector);
$openApiDispatcher->InjectRoutesFromConfig($applicationBridge, $openApiConfig);

$app->run();