PHPackages                             ronanflavio/laradocs-generate - 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. ronanflavio/laradocs-generate

ActiveLibrary[API Development](/categories/api)

ronanflavio/laradocs-generate
=============================

A package to create a simple API docs from your Laravel application

0.0.3(6y ago)08MITPHPPHP ^7.2

Since Mar 1Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ronanflavio/laradocs-generate)[ Packagist](https://packagist.org/packages/ronanflavio/laradocs-generate)[ RSS](/packages/ronanflavio-laradocs-generate/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

### Live preview

[](#live-preview)

[Click here](http://laradocs.ronanflavio.com.br/) to check the output result.

### Installation

[](#installation)

PHP 7.2 and Laravel 6.x or higher are required.

```
composer require --dev ronanflavio/laradocs-generate
```

After updating composer, add the service provider to the `providers` array in `config/app.php`

```
Ronanflavio\LaradocsGenerate\LaradocsGenerateServiceProvider::class,

```

### Generating docs

[](#generating-docs)

To generate docs simply run the command:

```
php artisan docs:generate
```

This command will create the `routes.json` file into your `resource` folder. The file will be used to provide data to render the view. You may want to ignore the `routes.json` file into your `.gitignore`.

Access your app host with `/docs` URI to see the docs page:

E.g.: `http://127.0.0.1:8000/docs`

### Writing docs

[](#writing-docs)

Tha main goal of this package is to indicate which specifically is the URI parameters, the request body parameters and what is coming within the response.

To achieve this, you may want to write some custom PHPDocs above your controller class, actions and your DTOs' properties. Let's see some practical examples:

#### Typing the request and response objects

[](#typing-the-request-and-response-objects)

To indicate which is the URI parameter type, use the default `@param` annotation.

To indicate which class object must be given within the request, you must write the full qualified name of it's class within the `@request` annotation.

To indicate which class object will be returned, you must write the full qualified name of it's class within the `@response` annotation. If there is no class object to be returned, just type the the variable type (e.g.: `boolean`, `int` etc...) instead. `void` will be provided if there is no `@response`.

```
