PHP code example of ronanflavio / laradocs-generate

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

    

ronanflavio / laradocs-generate example snippets




// namespace and uses here...

/**
 * Users management
 * 
 * Here will be shown the description of
 * your UsersController group. If there is
 * no description, the class name will be
 * shown instead.
 */
class UsersController extends Controller
{
    /**
     * Lists all users
     * @response \App\DataTransferObjects\User\ListUsersDto
     */
    public function index()
    {
        // your code here...
    }

    /**
     * Returns the details about the given user
     * @param string $id
     * @response \App\DataTransferObjects\User\UserDetailsDto
     */
    public function details(string $id)
    {
        // your code here...
    }
    
    /**
     * Creates a new user
     * @request \App\DataTransferObjects\User\CreateUserDto
     * @response \App\DataTransferObjects\User\UserDetailsDto
     */
    public function create(CreateUserRequest $request)
    {
        // your code here...
    }



namespace App\DataTransferObjects\User;

use App\DataTransferObjects\DataTransferObject;

class CreateUserDto extends DataTransferObject
{
    /**
     * @var string
     * @example [email protected]
     */
    public $email;

    /**
     * @var string
     * @example John Doe
     */
    public $name;

    /**
     * @var string
     * @example 123456
     */
    public $password;

    /**
     * @var string
     * @example 4c0c9e5d-f18f-4197-8531-02c90f9a81e0
     */
    public $role_id;
}

shell script
php artisan docs:generate
shell script
php artisan vendor:publish --provider="Ronanflavio\LaradocsGenerate\LaradocsGenerateServiceProvider" --tag=laradocs-config
shell script
php artisan vendor:publish --provider="Ronanflavio\LaradocsGenerate\LaradocsGenerateServiceProvider" --tag=laradocs-views