https://github.com/mako-framework/open-api
Generate routes based on OpenAPI specifications and OpenAPI specifications from code.
https://github.com/mako-framework/open-api
mako-framework mako-package openapi redoc swagger swagger-ui
Last synced: 3 months ago
JSON representation
Generate routes based on OpenAPI specifications and OpenAPI specifications from code.
- Host: GitHub
- URL: https://github.com/mako-framework/open-api
- Owner: mako-framework
- License: bsd-3-clause
- Created: 2020-10-22T18:00:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-03-04T22:57:47.000Z (4 months ago)
- Last Synced: 2025-04-13T03:07:47.065Z (3 months ago)
- Topics: mako-framework, mako-package, openapi, redoc, swagger, swagger-ui
- Language: PHP
- Homepage:
- Size: 84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenApi
[](https://github.com/mako-framework/open-api/actions/workflows/static-analysis.yml)
The `mako/open-api` package allows you to generate a [OpenApi](https://www.openapis.org) specification using [attributes](https://www.php.net/manual/en/language.attributes.php) or docblock annotations and to generate routes based on the specification.
## Requirements
Mako 11.0 or greater.
## Installation
First you'll need to install the package as a dependency to your project.
```
composer require mako/open-api
```Next you'll need to add the package to the `cli` section of the `packages` configuration array in the `application.php` config file.
```
'cli' => [
mako\openapi\OpenApiPackage::class,
]
```And finally replace the contents of your `routes.php` file with the following:
```php
Note that you have to set the `operationId` parameter to the fully qualified method name (e.g. app\controllers\Index::welcome) of your controller action for the route generator to work.```
openapi: 3.0.2
info:
title: Mako
version: 1.0.0
description: Mako example application.
paths:
'/':
summary: Displays a welcome page.
get:
operationId: 'app\controllers\Index::welcome'
```