1. Go to this page and download the library: Download brocc/laravel-openapi 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/ */
brocc / laravel-openapi example snippets
'documentations' => [
'default' => [
'title' => 'Docs - latest',
// Absolute path to the main OpenAPI specification.
'spec' => base_path('api-docs/v2/openapi.yaml'),
'routes' => [
// Route for accessing documentation UI.
'ui' => '/docs',
// Route to OpenAPI specification file, can be json or yaml.
'openapi' => '/openapi/v2/openapi.json',
// Middleware to be applied on the ui and docs, eg. api, auth, trusted_proxies etc.
'middleware' => [
'ui' => [],
'openapi' => [],
],
],
],
'v1' => [
'title' => 'Docs - v1',
'spec' => base_path('api-docs/v1/openapi.yaml'),
'routes' => [
'ui' => '/docs/v1',
'openapi' => '/openapi/v1/openapi.json',
'middleware' => [
'ui' => [],
'openapi' => [],
],
],
],
],