PHP code example of avalanche-development / swagger-router-middleware
1. Go to this page and download the library: Download avalanche-development/swagger-router-middleware 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/ */
avalanche-development / swagger-router-middleware example snippets
$router = new AvalancheDevelopment\SwaggerRouterMiddleware\Router([..swagger..]);
$result = $router($request, $response, $next); // middleware signature
'swagger' => [
'apiPath' => '/comments/{comment_id}', // matched string path
'path' => [ ... ], // full path definition
'operation' => [ ... ], // specific operation definition
'params' => [ ... ], // resolved list of parameters for this operation
'security' => [ ... ], // resolved list of securities
'schemes' => [ ... ], // resolved list of schemes
'produces' => [ ... ], // resolved list of producible content types
'consumes' => [ ... ], // resolved list of consumable content types
'responses' => [ ... ], // resolved list of responses
]