1. Go to this page and download the library: Download gungcahyadipp/auto-docs 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/ */
// app/Http/Controllers/Api/V1/UserController.php
namespace App\Http\Controllers\Api\V1;
class UserController extends Controller
{
public function store(StoreUserRequest $request)
{
// Your logic here — NO PHPDoc needed for description
return new UserResource(User::create($request->validated()));
}
}
/**
* @unauthenticated
*/
public function login(LoginRequest $request)
{
// Description comes from autodocs/AuthController/login.md
// @unauthenticated still works from PHPDoc
}
bash
# Generate for all API routes
php artisan autodocs:generate
# Only generate for v2 routes
php artisan autodocs:generate --api-path=api/v2
# Regenerate all (overwrite existing)
php artisan autodocs:generate --force
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.