PHPackages                             apoplavs/laravel-autodoc - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. apoplavs/laravel-autodoc

ActiveLibrary[Testing &amp; Quality](/categories/testing)

apoplavs/laravel-autodoc
========================

Provided middleware for auto generating of OpenApi documentation file by run testing of your API.

1.0.2(5y ago)19.1k2MITBladePHP &gt;=7.1.0

Since Apr 14Pushed 4y ago2 watchersCompare

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

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Laravel AutoDoc plugin
======================

[](#laravel-autodoc-plugin)

This library is designed to gather information passing the features tests and generate documentation about your API. The principle of operation is based on the fact that the special Middleware installed on the Route for which you want to collect information that after the successful completion of all tests generated Swagger-file. In addition this plug-in is able to draw Swagger-template to display the generated documentation for a config.

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

[](#installation)

### Composer

[](#composer)

1. `composer require apoplavs/laravel-swagger`

### Laravel

[](#laravel)

1. add `Apoplavs\Support\AutoDoc\AutoDocServiceProvider::class,` to providers in `config/app.php`
2. run `php artisan vendor:publish`

### Plugin

[](#plugin)

1. Add middleware **\\Apoplavs\\Support\\AutoDoc\\Http\\Middleware\\AutoDocMiddleware::class** to *Http/Kernel.php*.
2. Use **\\Apoplavs\\Support\\AutoDoc\\Tests\\AutoDocTestCaseTrait** in your TestCase in *tests/TestCase.php*
3. In *config/auto-doc.php* you can specify enabling of plugin, info of your project, some defaults descriptions and route for rendering of documentation.
4. In *.env* file you should add following lines ```
    AUTODOC_ENABLED=true
    LOCAL_DATA_COLLECTOR_PROD_PATH=/example-folder/documentation.json
    LOCAL_DATA_COLLECTOR_TEMP_PATH=/tmp/documentation.json

    ```

AUTODOC\_ENABLED - enable or disable generate of documentation when passing a tests

LOCAL\_DATA\_COLLECTOR\_...\_PATH - custom path to your generated documentation file

You can disable autodoc for one test, just need before running test, set `AutoDocMiddleware::$skipped = true;`

Usages
------

[](#usages)

For correct working of plugin you have to dispose all the validation rules in the rules() method of class YourRequest, which must be connected to the controller via DependencyInjection. In annotation of custom request you can specify summary and description of this request. Plugin will take validation rules from your request and use it as description of input parameter. If you want to set to common description of your API endpoints you can rewrite swagger-description.blade.php in your views and customize as you want. It will be render as blade template.

### Example

[](#example)

```
