julfiker/swagger-laravel

There is no license information available for the latest version (v1.0.1) of this package.

Api document based on swagger

v1.0.1 2018-11-02 10:23 UTC

This package is auto-updated.

Last update: 2024-12-05 20:03:23 UTC


README

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!!! 😄