Skip to content

Simple package to autogenerate Api doc using Laravel Unit Test

License

Notifications You must be signed in to change notification settings

c00p3r/laravel-api-doc-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-api-doc-provider

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!

About

Simple package to autogenerate Api doc using Laravel Unit Test

Resources

License

Stars

Watchers

Forks

Packages

No packages published