PHPackages                             yuritsuki/laravel-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. yuritsuki/laravel-swagger

ActiveLibrary[API Development](/categories/api)

yuritsuki/laravel-swagger
=========================

Provided middleware for generating of swagger-documentation file by run testing of restful API.

070PHP

Since Sep 13Pushed 2y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

[![](resources/assets/images/hero.svg)](resources/assets/images/hero.svg)

Laravel Swagger plugin
======================

[](#laravel-swagger-plugin)

[![Total Downloads](https://camo.githubusercontent.com/3053dfa7e7008ce9f296f7da58575458ebdb2389d938c18efe784d20124e6029/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6e617369742f6c61726176656c2d73776167676572)](https://packagist.org/packages/ronasit/laravel-swagger)[![Latest Stable Version](https://camo.githubusercontent.com/67f6658d2ee803bb80d81939cdad100f4b49bdf3f94ab6d319639253a1aeca0d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6e617369742f6c61726176656c2d73776167676572)](https://packagist.org/packages/ronasit/laravel-swagger)[![License](https://camo.githubusercontent.com/d02ffd695fef91c41ef4bf81a341dfd4b31f570dc2a714677bd15fb91cd20ac3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f726f6e617369742f6c61726176656c2d73776167676572)](https://packagist.org/packages/ronasit/laravel-swagger)

[![Laravel Swagger](https://github.com/RonasIT/laravel-swagger/actions/workflows/laravel.yml/badge.svg?branch=master)](https://github.com/RonasIT/laravel-swagger/actions/workflows/laravel.yml)[![Coverage Status](https://camo.githubusercontent.com/10164aacc0fc3db31fcc76b7488c1a4f05f344e51210c0d5ad2c69b291df4182/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f526f6e617349542f6c61726176656c2d737761676765722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/RonasIT/laravel-swagger?branch=master)

Introduction
------------

[](#introduction)

This plugin is designed to generate documentation for your REST API during the passing PHPUnit tests.

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

[](#installation)

1. Install the package using the following command: `composer require ronasit/laravel-swagger`

    > ***Note***
    >
    > For Laravel 5.5 or later the package will be auto-discovered. For older versions add the `AutoDocServiceProvider` to the providers array in `config/app.php` as follow:
    >
    > ```
    > 'providers' => [
    >    // ...
    >    RonasIT\Support\AutoDoc\AutoDocServiceProvider::class,
    > ],
    > ```
2. Run `php artisan vendor:publish`
3. Add `\RonasIT\Support\AutoDoc\Http\Middleware\AutoDocMiddleware::class` middleware to the global HTTP middleware stack in `Http/Kernel.php`.
4. Add `\RonasIT\Support\AutoDoc\Tests\AutoDocTestCaseTrait` trait to `tests/TestCase.php`
5. Configure documentation saving using one of the next ways:

- Add `SwaggerExtension` to the `` block of your `phpunit.xml`. **Please note that this way will be removed after updating****PHPUnit up to 10 version ([sebastianbergmann/phpunit#4676](https://github.com/sebastianbergmann/phpunit/issues/4676))**```

            ./tests/Feature

    ```
- Call `php artisan swagger:push-documentation` console command after the `tests` stage in your CI/CD configuration

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

1. Create request class:

    ```
