PHP code example of g4t / swagger

1. Go to this page and download the library: Download g4t/swagger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

g4t / swagger example snippets


   Route::get('user', [UserController::class, 'index'])->description('Get list of users with pagination.');
   

   Route::get('user', [UserController::class, 'index'])->summary('get users.');
   

   Route::get('user', [UserController::class, 'index'])->hiddenDoc();
   

   

   namespace App\Http\Controllers;

   use G4T\Swagger\Attributes\SwaggerSection;

   #[SwaggerSection('everything about your users')]
   class UserController extends Controller
   {
       // ...
   }
   

   "enable_auth" => false,
   "username" => "admin",
   "password" => "pass",
   "sesson_ttl" => 100000,
   
bash
   php artisan vendor:publish --provider "G4T\Swagger\SwaggerServiceProvider"
   
bash
php artisan make:swagger
php artisan swagger:cache
php artisan swagger:cache --clear
php artisan swagger:mock-server
bash
php artisan swagger:mock-server
bash
php artisan make:swagger
bash
php artisan swagger:cache
php artisan swagger:cache --clear