PHPackages                             mako/open-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. mako/open-api

ActiveLibrary[Framework](/categories/framework)

mako/open-api
=============

Generate routes based on OpenAPI specifications and OpenAPI specifications from code

4.0.1(4mo ago)036.2k↓21.9%BSD-3-ClausePHPPHP &gt;=8.5.0CI passing

Since Dec 19Pushed 1mo agoCompare

[ Source](https://github.com/mako-framework/open-api)[ Packagist](https://packagist.org/packages/mako/open-api)[ Docs](http://makoframework.com)[ RSS](/packages/mako-open-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (25)Used By (0)

OpenApi
=======

[](#openapi)

[![Static analysis](https://github.com/mako-framework/open-api/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/mako-framework/open-api/actions/workflows/static-analysis.yml)

The `mako/open-api` package allows you to generate an [OpenApi](https://www.openapis.org) specification by documenting your code using PHP [attributes](https://www.php.net/manual/en/language.attributes.php), and to generate routes from an OpenAPI specification.

In addition, the package can render interactive API documentation for your OpenAPI specification using one of the following user interface providers:

- Elements
- Redoc
- Scalar
- Swagger (default)

Requirements
------------

[](#requirements)

Mako 12.0 or greater.

Installation
------------

[](#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:

```
