Skip to content

Api documentation based on swagger in Laravel framework. It would server ui based on swagger ui released.

License

Notifications You must be signed in to change notification settings

julfiker/swagger-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

swagger api documentation for laravel

Api documentation based on swagger for Laravel framework. It would serve run time environment with the ui based on swagger ui latest released. You can test and documenting about the every each action and request object along with each properties you can explain. Just annotation based very simple. You can manage everything as you needs.

Note: - only for laravel framework. It would competitable with any lts version of laravel.

Instuction how to use the package on laravel.

Install package by composer:
composer require julfiker/swagger-laravel
Just run composer require command with package name. This assumes you have composer installed and available in your path as composer. Instruction to have composer https://getcomposer.org/doc/00-intro.md.

Post install
Configure the service into the applicaton, Please add following into the config/app.php under the providers
Julfiker\Swagger\SwaggerServiceProvider::class
Then run following command
php artisan vendor:publish
Thats it!!!

Usage instruction by annotation:
Add annotations to your php files. You must need to use @OA\Info() only one time in any php files under the app directly. I can recomment to home or welcome page controller that it would render your application home page. Then add each controller action in the api controller class.

/**
 * Only one time for the application
 * @OA\Info(title="My Laravel REST API", version="1.0") 
 */
 class WelcomeController {
   //Action method and others
 }

/**
 * Action method
 * @OA\Get(
 *     path="/v1/resources",
 *     @OA\Response(response="200", description="About the resources")
 * )
 */
 public function index(){
   //Your code
 }

For further study on annotation to use - http://zircote.com/swagger-php/Getting-started.html#annotation-placement

Access swagger documents:
http://{project-url}/swagger/doc

Any Help?
You can contact me if you need anything on this regards, My contacts information ~
email: mail.julfiker@gmail.com
skype: eng.jewel

Enjoy!!! 😄

About

Api documentation based on swagger in Laravel framework. It would server ui based on swagger ui released.

Resources

License

Stars

Watchers

Forks

Packages

No packages published