PHPackages                             alt3/cakephp-swagger - 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. [API Development](/categories/api)
4. /
5. alt3/cakephp-swagger

ActiveCakephp-plugin[API Development](/categories/api)

alt3/cakephp-swagger
====================

Instant Swagger documentation for your CakePHP 4.x APIs

4.0.1(6y ago)64197.3k↓32.4%17[8 issues](https://github.com/alt3/cakephp-swagger/issues)[1 PRs](https://github.com/alt3/cakephp-swagger/pulls)3MITJavaScriptPHP &gt;=7.0CI failing

Since Sep 7Pushed 4y ago5 watchersCompare

[ Source](https://github.com/alt3/cakephp-swagger)[ Packagist](https://packagist.org/packages/alt3/cakephp-swagger)[ RSS](/packages/alt3-cakephp-swagger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (3)Versions (12)Used By (3)

cakephp-swagger
===============

[](#cakephp-swagger)

[![Build Status](https://camo.githubusercontent.com/f3c7e26f571ebac61df4d365dc8bab50a73bd87426f1bd3e7b7cb395de0572b9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616c74332f63616b657068702d737761676765722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/alt3/cakephp-swagger)[![StyleCI Status](https://camo.githubusercontent.com/9786dee37fc36f9dc01ab5f12f6214e3f75578f6a83f690d39232f0fac73fc49/68747470733a2f2f7374796c6563692e696f2f7265706f732f34353734313934382f736869656c64)](https://styleci.io/repos/45741948)[![Coverage Status](https://camo.githubusercontent.com/0fa9086c8c5da473e5199b2c5a09225026ab80352c2c0491a209474b1e7f9805/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f616c74332f63616b657068702d737761676765722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/alt3/cakephp-swagger)[![Total Downloads](https://camo.githubusercontent.com/6cb6327139121367882502bfe7378afaaa4e6dec8b528e436775090881a5f423/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c74332f63616b657068702d737761676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alt3/cakephp-swagger)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

CakePHP 4.x plugin that adds auto-generated Swagger 2.0 documentation to your projects using swagger-php and swagger-ui.

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

[](#requirements)

- CakePHP 4.0+
- Some [swagger-php](https://github.com/zircote/swagger-php) annotation knowledge

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

[](#installation)

Install the plugin using composer:

```
composer require alt3/cakephp-swagger
```

Enabling
--------

[](#enabling)

Enable the plugin in the `bootstrap()` method found in `src/Application.php`:

```
    public function bootstrap()
    {
        parent::bootstrap();
        $this->addPlugin('Alt3/Swagger');
    }
```

> Also make sure that AssetMiddleware is loaded inside `Application.php` or all Swagger page assets will 404.

Installation check
------------------

[](#installation-check)

After enabling the plugin, browsing to `http://your.app/alt3/swagger` should now produce the [Swagger-UI](http://swagger.io/swagger-ui/) interface:

[![Default UI index](/docs/images/ui-index-default.png)](/docs/images/ui-index-default.png)

Configuration
-------------

[](#configuration)

All configuration for this plugin is done through the `/config/swagger.php`configuration file. TLDR full example below.

```
