PHPackages                             ping-xiong/idoc - 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. ping-xiong/idoc

ActiveLibrary[API Development](/categories/api)

ping-xiong/idoc
===============

Generate beautiful API documentation from your Laravel application

v1.4.0(5y ago)013MITPHPPHP &gt;=7.0.0

Since Mar 31Pushed 5y agoCompare

[ Source](https://github.com/ping-xiong/idoc)[ Packagist](https://packagist.org/packages/ping-xiong/idoc)[ Docs](http://github.com/ovac/idoc)[ RSS](/packages/ping-xiong-idoc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (11)Versions (8)Used By (0)

 [![](https://camo.githubusercontent.com/a7125b35dc591ca48c1b6ca3aa49ff2db2d3dfc522c82703779a029003007aba/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f6f7661632f696d6167652f75706c6f61642f685f35302f76313535333937363438362f315f5166393478467764653432314a5f5a536d64504a44775f736f6565336d2e706e67)](https://https://www.openapis.org/)
[![](https://camo.githubusercontent.com/4df8eac0191a53df2390c529625401d251ebdcb751f329b4b2515ed051da5ddb/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f6f7661632f696d6167652f75706c6f61642f685f35302f76313535333937353333302f4332493245464e325f343030783430305f716375796f702e6a7067)](https://https://www.openapis.org/)[![](https://camo.githubusercontent.com/da33047295fb89dc08896c2adb79be8cc4f659185a0e8f6e2733c3fbe56b35e2/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f6f7661632f696d6167652f75706c6f61642f685f3132302f76313530363832383738362f6c6f676f2d636f6d706f7365722d7472616e73706172656e745f7a6a67616c302e706e67)](#)[![](https://camo.githubusercontent.com/bd19274b6f5c17fccda6394e6e3c96831ad26a49745be2b3ee47ff7fe914de71/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f6f7661632f696d6167652f75706c6f61642f685f35302c775f36302c635f66696c6c2f76313530363833323939322f6c61726176656c2d6c6f676f5f61746c7666772e706e67)](#)
 [![](https://camo.githubusercontent.com/f0f644ff9bbb59eae4181c770db86ef64a4a3c3f8c0aebb35d284c02daec5248/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f6f7661632f696d6167652f75706c6f61642f725f3230302c775f3330302c685f35302c635f66696c6c2f76313530363832383338302f6c6f676f5f73697a655f696e766572745f6a656c6837342e6a7067)](https://www.ovac4u.com/idoc)

[![Latest Stable Version](https://camo.githubusercontent.com/b66226175fcc95502740b94e7e9b7734ccebc5ca8cd6b73c623f2bffc06df41e/68747470733a2f2f706f7365722e707567782e6f72672f6f7661632f69646f632f762f737461626c65)](https://packagist.org/packages/ovac/idoc)[![Total Downloads](https://camo.githubusercontent.com/0c8498b726f0c5fc2cab92adc2845b9c8502b8974df18781af8fb24d975fd484/68747470733a2f2f706f7365722e707567782e6f72672f6f7661632f69646f632f646f776e6c6f616473)](https://packagist.org/packages/ovac/idoc)[![License](https://camo.githubusercontent.com/f433d3ed6643d3a7814fc4a149c7493046337a9b75c3216ec104c66a25c46098/68747470733a2f2f706f7365722e707567782e6f72672f6f7661632f69646f632f6c6963656e7365)](https://packagist.org/packages/ovac/idoc)

```
              Follow me anywhere @ovac4u                         | GitHub
              _________                          _________       | Twitter
             |   ___   |.-----.--.--.---.-.----.|  |  |.--.--.   | Facboook
             |  |  _   ||  _  |  |  |  _  |  __||__    |  |  |   | Instagram
             |  |______||_____|\___/|___._|____|   |__||_____|   | Github + @ovac
             |_________|                        www.ovac4u.com   | Facebook + @ovacposts
```

Laravel IDoc - The API Documentation Generator
----------------------------------------------

[](#laravel-idoc---the-api-documentation-generator)

Automatically generate an interactive API documentation from your existing Laravel routes. Take a look at the [example documentation](https://redocly.github.io/redoc/). Inspired by [Laravel Api Documentation Generator](https://github.com/mpociot/laravel-apidoc-generator)

Introduction.
=============

[](#introduction)

Laravel IDoc generator (interactive documentation generator) is a seamless and complete plugin for generating API documentation from your Laravel's codebase. It is inspired by the laravel-apidoc-generator, ReDoc and the Open API initiative from Swagger. IDoc has been built with extendability so that it can easily adapt with your use case.

[![Demo](https://raw.githubusercontent.com/Rebilly/ReDoc/master/demo/redoc-demo.png)](https://raw.githubusercontent.com/Rebilly/ReDoc/master/demo/redoc-demo.png)

Features
--------

[](#features)

- Extremely easy deployment
- Server Side Rendering ready
- The widest OpenAPI v2.0 features support
    [![](https://raw.githubusercontent.com/Rebilly/ReDoc/master/docs/images/discriminator-demo.gif)](https://raw.githubusercontent.com/Rebilly/ReDoc/master/docs/images/discriminator-demo.gif){.inline}
- OpenAPI 3.0 support
- Neat **interactive** documentation for nested objects
    [![](https://raw.githubusercontent.com/Rebilly/ReDoc/master/docs/images/nested-demo.gifdocs/images/nested-demo.gif)](https://raw.githubusercontent.com/Rebilly/ReDoc/master/docs/images/nested-demo.gifdocs/images/nested-demo.gif){.inline}
- Automatic code sample support
    [![](https://raw.githubusercontent.com/Rebilly/ReDoc/master/docs/images/code-samples-demo.gif)](https://raw.githubusercontent.com/Rebilly/ReDoc/master/docs/images/code-samples-demo.gif){.inline}
- Responsive three-panel design with menu/scrolling synchronization
- Integrate API Introduction into side menu.
- High-level grouping in side-menu.
- Branding/customizations.

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

[](#installation)

> Note: PHP 7 and Laravel 5.5 or higher are the minimum dependencies.

```
$ composer require ovac/idoc
```

### Laravel

[](#laravel)

Publish the config file by running:

```
php artisan vendor:publish --tag=idoc-config
```

This will create an `idoc.php` file in your `config` folder.

### Lumen

[](#lumen)

- Register the service provider in your `bootstrap/app.php`:

```
$app->register(\OVAC\IDoc\IDocServiceProvider::class);
```

- Copy the config file from `vendor/ovac/idoc/config/idoc.php` to your project as `config/idoc.php`. Then add to your `bootstrap/app.php`:

```
$app->configure('idoc');
```

Usage
-----

[](#usage)

```
$ php artisan idoc:generate
```

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

[](#configuration)

Before you can generate your documentation, you'll need to configure a few things in your `config/idoc.php`.

- `path`This will be used to register the necessary routes for the package.

```
'path' => 'idoc',
```

- `logo`You can specify your custom logo to be used on the generated documentation. A relative or absolute url to the logo image.

```
'logo' => 'https://res.cloudinary.com/ovac/image/upload/h_300,w_380,c_fill,r_30,bo_20px_solid_white/aboust_ey5v1v.jpg',
```

- `title`Here, you can specify the title to place on the documentation page.

```
'title' => 'iDoc API Reference',
```

- `description`This will place a description on top of the documentation.

```
'description' => 'iDoc Api secification and documentation.',
```

- `version`Documentation version number.
- `terms_of_service`This is the url to the terms and conditions for use your API.
- `contact`Here you can configure contact information for support.

```
'contact' => [
        'name' => 'API Support',
        'email' => 'iamovac@gmail.com',
        'url' => 'http://www.ovac4u.com'
],
```

- `license`A short and simple permissive license with conditions only requiring preservation of copyright and license notices

```
'license' => [
        'name' => 'MIT',
        'url' => 'https://github.com/ovac/idoc/blob/master/LICENSE.md'
],
```

- `output`This package can automatically generate an Open-API 3.0 specification file for your routes, along with the documentation. This is the file path where the generated documentation will be written to. Default: **public/docs**
- `hide_download_button`This section is where you can configure if you want a download button visible on the documentation.
- `router`The router to use when processing the route (can be Laravel or Dingo. Defaults to **Laravel**)
- `servers`The servers array can be used to add multiple endpoints on the documentation so that the user can switch between endpoints. For example, This could be a test server and the live server.

```
'servers' => [
   [
       'url' => 'https://www.ovac4u.com',
       'description' => 'App live server.',
   ],
   [
       'url' => 'https://test.ovac4u.com',
       'description' => 'App test server.',
   ],
],
```

- `tag_groups`This array is used to separate groups that you have defined in little sections in the side menu. If you want to use it, make sure you add all groups because the unadded group will not be displayed.
- `language-tabs`This is where you can set languages used to write request samples. Each item in array is used to generate a request template for a given language. New languages can be added and the existing ones modified after. You can add or edit new languages tabs by publishing the view files and editing them or adding custom view files to:

```
'resources/views/vendor/idoc/languages/LANGUAGE.blade.php',
```

- `security`This is where you specify authentication and authorization schemes, by default the HTTP authentication scheme using Bearer is setting but you can modify it, add others or even define it as null according to the requirements of your project. For more information, please visit [Swagger Authentication](https://swagger.io/docs/specification/authentication/).

```
'security' => [
       'BearerAuth' => [
           'type' => 'http',
           'scheme' => 'bearer',
           'bearerFormat' => 'JWT',
       ],
   ],
```

- `routes`This is where you specify what rules documentation should be generated for. You specify routes to be parsed by defining conditions that the routes should meet and rules that should be applied when generating documentation. These conditions and rules are specified in groups, allowing you to apply different rules to different routes.

For instance, suppose your configuration looks like this:

```
return [
     //...,

     /*
     * The routes for which documentation should be generated.
     * Each group contains rules defining which routes should be included ('match', 'include' and 'exclude' sections)
     * and rules which should be applied to them ('apply' section).
     */
    'routes' => [
        [
            /*
             * Specify conditions to determine what routes will be parsed in this group.
             * A route must fulfill ALL conditions to pass.
             */
            'match' => [

                /*
                 * Match only routes whose domains match this pattern (use * as a wildcard to match any characters).
                 */
                'domains' => [
                    '*',
                    // 'domain1.*',
                ],

                /*
                 * Match only routes whose paths match this pattern (use * as a wildcard to match any characters).
                 */
                'prefixes' => [
                    'api/*',
                ],

                /*
                 * Match only routes registered under this version. This option is ignored for Laravel router.
                 * Note that wildcards are not supported.
                 */
                'versions' => [
                    'v1',
                ],
            ],

            //...
        ],
    ],
```

This means documentation will be generated for routes in all domains ('\*' is a wildcard meaning 'any character') which match any of the patterns 'api/\*' or 'v2-api/\*', excluding the 'users.create' route and any routes whose names begin with `admin.`, and including the 'users.index' route and any routes whose names begin with `healthcheck.`. (The `versions` key is ignored unless you are using Dingo router). Also, in the generated documentation, these routes will have the header 'Authorization: Bearer: {token}' added to the example requests.

You can also separate routes into groups to apply different rules to them:

```
