restio/laravel-api-doc-provider

Simple package for autogenerate API doc with Laravel framework

This package's canonical repository appears to be gone and the package has been frozen as a result.

v2.0.2 2017-10-23 11:35 UTC

This package is not auto-updated.

Last update: 2024-01-15 03:18:39 UTC


README

Simple API Doc generator based on Controller Annotations using with Laravel 5.2.* | 5.3.*

Install by steps:

Update your composer via command:

composer require restio/laravel-api-doc-provider

Add the service provider to the providers array in config/app.php

RestioDocProvider\RestioDocProvider::class,

Run artisan command:

php artisan clear-compiled
php artisan optimize

Publish vendor

php artisan vendor:publish

Configure

config/restio_doc.php

Start annotate your Controllers (for ex. app\Http\Controllers\ExampleController.php)

About annotation

@route                example_index
@description          Example description for route
@required_params      [token]
@optional_params      [page]
  • @route - route name from RouteCollection
  • @description - short description about this route (ex. Main page, List of Users etc.)
  • @required_params - Required params (this params be marked with red star)
  • @optional_params - Optional params
  • token, page - params in app/Models/Doc.php

Write unitTest with write success response to json objects (for ex. tests/RestioExampleTest.php)

Run unit tests for generate success responses

php phpunit

After testing we must regenerate all API DOC with command

php artisan generate:docs

Enjoy!