PHP code example of wfgm5k2d / phplightdoc

1. Go to this page and download the library: Download wfgm5k2d/phplightdoc 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/ */

    

wfgm5k2d / phplightdoc example snippets


// group Users
final class UserController extends Controller

#[DocGName('Users')]
final class UserController extends Controller

// This controller will be placed in the "Users API" subgroup within the main "Users" group
#[DocGName('Users API', 'Users')]
final class UserController extends Controller {
    // ...
}

// This controller will be placed in the "Authentication" subgroup within the same main "Users" group
#[DocGName('Authentication', 'Users')]
final class AuthController extends Controller {
    // ...
}

// name Create a compensation request
public function createApplication(Request $request): JsonResponse

#[DocRName('Create a compensation request')]
public function createApplication(Request $request): JsonResponse

// middleware-name Authentication : Bearer {token}
final class SecureController extends Controller

#[DocMiddleware('Authentication tends Controller

return response()->json()
return new JsonResponse([])
return new JsonResponse([], Response::HTTP_...)
return new JsonResponse([], 200)

// response-codes 200 404 500
public function getUserData(Request $request): JsonResponse

#[DocResponseCodes()]
public function getUserData(Request $request): JsonResponse

'providers' => [
    ...
    \Wfgm5k2d\PhpLightDoc\Providers\PhpLightDocServiceProvider::class,
]

return [
    ...
    \Wfgm5k2d\PhpLightDoc\Providers\PhpLightDocServiceProvider::class,
]
bash
composer 
bash
php artisan vendor:publish --provider='Wfgm5k2d\PhpLightDoc\Providers\PhpLightDocServiceProvider'
bash
php artisan doc:generate
bash
php artisan doc:generate
bash
laravel new php-light-doc
bash
cd php-light-doc
mkdir "packages"