PHPackages                             g-six/l5-api-documentor - 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. g-six/l5-api-documentor

ActiveLibrary[API Development](/categories/api)

g-six/l5-api-documentor
=======================

Generate beautiful API documentation from your Laravel application

v0.0.9(8y ago)0890MITPHPPHP &gt;=5.5.0

Since Apr 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/g-six/l5-api-documentor)[ Packagist](https://packagist.org/packages/g-six/l5-api-documentor)[ Docs](http://github.com/g-six/l5-api-documentor)[ RSS](/packages/g-six-l5-api-documentor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (9)Versions (10)Used By (0)

Laravel API Documentation Generator
-----------------------------------

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

Automatically generate your API documentation from your existing Laravel routes. Take a look at the [example documentation](http://marcelpociot.de/whiteboard/).

After a month of customising since forking from , there are a lot of changes made to fit our laravel base code ecosystem.

Please take note of the changes in options below as they are different from Mpociot's original code. Great work @mpociot.

`php artisan api:gen --routePrefix="settings/api/*"`

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

[](#installation)

Require this package with composer using the following command:

```
$ composer require g-six/l5-api-documentor
```

Go to your `config/app.php` and add the service provider:

```
G6\ApiDoc\ApiDocGeneratorServiceProvider::class,
```

> Using Laravel &lt; 5.4? Use version 1.0! For Laravel 5.4 and up, use 2.0 instead.

Usage
-----

[](#usage)

To generate your API documentation, use the `api:generate` artisan command.

```
$ php artisan api:generate --routePrefix="api/v1/*"
```

This command will scan your applications routes for the URIs matching `api/v1/*` and will parse these controller methods and form requests. For example:

```
// API Group Routes
Route::group(array('prefix' => 'api/v1', 'middleware' => []), function () {
	// Custom route added to standard Resource
	Route::get('example/foo', 'ExampleController@foo');
	// Standard Resource route
	Route::resource('example', 'ExampleController'));
});
```

### Available command options:

[](#available-command-options)

OptionDescription`output` The output path used for the generated documentation. Default: `public/docs``routePrefix`The route prefix to use for generation - `*` can be used as a wildcard`routes`The route names to use for generation - Required if no routePrefix is provided`middleware`The middlewares to use for generation`noResponseCalls`Disable API response calls`noPostmanCollection`Disable Postman collection creation`useMiddlewares`Use all configured route middlewares (Needed for Laravel 5.3 `SubstituteBindings` middleware)`auth`A JSON object notation that contains credentials to different users with different roles required to access the API routes.`router`The router to use, when processing the route files (can be Laravel or Dingo - defaults to Laravel)`bindings`List of route bindings that should be replaced when trying to retrieve route results. Syntax format: `binding\_one,id`force`Force the re-generation of existing/modified API routes`header`Custom HTTP headers to add to the example requests. Separate the header name and value with ":". For example: `--header 'Authorization: CustomToken'`Publish rule descriptions for customisation or translation.
-----------------------------------------------------------

[](#publish-rule-descriptions-for-customisation-or-translation)

By default, this package returns the descriptions in english. You can publish the packages language files, to customise and translate the documentation output.

```
$ php artisan vendor:publish
```

After the files are published you can customise or translate the descriptions in the language you want by renaming the `en` folder and editing the files in `public/vendor/apidoc/resources/lang`.

### How does it work?

[](#how-does-it-work)

This package uses these resources to generate the API documentation:

#### Controller doc block

[](#controller-doc-block)

This package uses the HTTP controller doc blocks to create a table of contents and show descriptions for your API methods.

Using `@resource` in a doc block prior to each controller is useful as it creates a Group within the API documentation for all methods defined in that controller (rather than listing every method in a single list for all your controllers), but using `@resource` is not required. The short description after the `@resource` should be unique to allow anchor tags to navigate to this section. A longer description can be included below.

Above each method within the controller you wish to include in your API documentation you should have a doc block. This should include a unique short description as the first entry. An optional second entry can be added with further information. Both descriptions will appear in the API documentation in a different format as shown below.

```
/**
 * @resource Example
 *
 * Longer description
 */
class ExampleController extends Controller {

	/**
	 * This is the short description [and should be unique as anchor tags link to this in navigation menu]
	 *
	 * This can be an optional longer description of your API call, used within the documentation.
	 *
	 */
	 public function foo(){

	 }
```

**Result:**

[![Doc block result](https://camo.githubusercontent.com/5acbb8764bb5b4b40504968cf5618fc0e2f71f006d4cb712bb0773c219d7bd16/687474703a2f2f6865616473717561726564736f6674776172652e636f2e756b2f696d616765732f6170695f67656e657261746f725f646f63626c6f636b2e706e67)](https://camo.githubusercontent.com/5acbb8764bb5b4b40504968cf5618fc0e2f71f006d4cb712bb0773c219d7bd16/687474703a2f2f6865616473717561726564736f6674776172652e636f2e756b2f696d616765732f6170695f67656e657261746f725f646f63626c6f636b2e706e67)

#### Form request validation rules

[](#form-request-validation-rules)

To display a list of valid parameters, your API methods accepts, this package uses Laravels [Form Requests Validation](https://laravel.com/docs/5.2/validation#form-request-validation).

```
public function rules()
{
    return [
        'title' => 'required|max:255',
        'body' => 'required',
        'type' => 'in:foo,bar',
        'thumbnail' => 'required_if:type,foo|image',
    ];
}
```

**Result:** [![Form Request](https://camo.githubusercontent.com/bbfde84c1a88d740a02896f51757e519f987fade9af9cdf633c92aff28f522c6/687474703a2f2f6d617263656c706f63696f742e64652f646f63756d656e74617269616e2f666f726d5f726571756573742e706e67)](https://camo.githubusercontent.com/bbfde84c1a88d740a02896f51757e519f987fade9af9cdf633c92aff28f522c6/687474703a2f2f6d617263656c706f63696f742e64652f646f63756d656e74617269616e2f666f726d5f726571756573742e706e67)

#### API responses

[](#api-responses)

If your API route accepts a `GET` method, this package tries to call the API route with all middleware disabled to fetch an example API response.

With Mpciot's version, if your API needs an authenticated user, you can use the `actAsUserId` option to specify a user ID that will be used for making these API calls, this doesn't work with our base code, so we added the --auth option with parameters required by our auth.

```
$ php artisan api:generate --routePrefix="api/*" --auth={"admin": {"username": "username", "password": "some password", "type": "admin"}}
```

If you don't want to automatically perform API response calls, use the `noResponseCalls` option.

```
$ php artisan api:generate --routePrefix="api/*" --noResponseCalls
```

> Note: The example API responses work best with seeded data.

#### Postman collections

[](#postman-collections)

The generator automatically creates a Postman collection file, which you can import to use within your [Postman App](https://www.getpostman.com/apps) for even simpler API testing and usage.

If you don't want to create a Postman collection, use the `--noPostmanCollection` option, when generating the API documentation.

As of as of Laravel 5.3, the default base URL added to the Postman collection will be that found in your Laravel `config/app.php` file. This will likely be `http://localhost`. If you wish to change this setting you can directly update the url or link this config value to your environment file to make it more flexible (as shown below):

```
'url' => env('APP_URL', 'http://yourappdefault.app'),
```

If you are referring to the environment setting as shown above, then you should ensure that you have updated your `.env` file to set the APP\_URL value as appropriate. Otherwise the default value (`http://yourappdefault.app`) will be used in your Postman collection. Example environment value:

```
APP_URL=http://yourapp.app

```

Skip single routes
------------------

[](#skip-single-routes)

If you want to skip a single route from a list of routes that match a given prefix, you can use the `@hideFromAPIDocumentation` tag on the Controller method you do not want to document.

### License

[](#license)

The Laravel API Documentation Generator is free software licensed under the MIT license forked () and customized to work with our team's base code.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Recently: every ~10 days

Total

9

Last Release

3275d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e772d14188ab0e9583841eb9ba752f82355c73bd4b4188a761decef8f5e70344?d=identicon)[g-six](/maintainers/g-six)

---

Tags

apilaraveldocumentation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/g-six-l5-api-documentor/health.svg)

```
[![Health](https://phpackages.com/badges/g-six-l5-api-documentor/health.svg)](https://phpackages.com/packages/g-six-l5-api-documentor)
```

###  Alternatives

[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)[mpociot/laravel-apidoc-generator

Generate beautiful API documentation from your Laravel application

3.5k3.1M12](/packages/mpociot-laravel-apidoc-generator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
