PHP code example of yaro / apidocs

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

    

yaro / apidocs example snippets


'providers' => [
    //...
    Yaro\ApiDocs\ServiceProvider::class,
    //...
]

'aliases' => [
    //...
    'ApiDocs' => Yaro\ApiDocs\Facade::class,
    //...
]

//...
'disks' => [
    //...
    'apidocs' => [
        'driver' => 'local',
        'root'   => storage_path('apidocs'),
    ],
//...    

/**
 * Some api endpoint for important stuff.
 * 
 * Just show some template with     
 * some very long description    
 * on several lines
 * 
 * @param int    $offset   Just an offset size
 * @param string $password 
 */
public function getSomeStuff()
{
    return response()->json([]);
}

Route::get('/docs', function() {
    return ApiDocs::show();
});

Route::get('/docs', function() {
    return ApiDocs::show();
})->middleware(['apidocs.auth.basic']);

'exclude' => [
    'classes' => [
        // 'App\Http\Controllers\*' - exclude all controllers from docs.
        // 'App\Http\Controllers\MyController@*' - remove all methods for specific controller from docs.
    ],
    
    'routes' => [
        // 'payment/test',
        // 'simulate/*',
    ],
 ],

ApiDocs::blueprint()->create();
// or pass snapshot name and/or filesystem disc name
ApiDocs::blueprint()->create('my-newest-snapshot', 's3-blueprint');

echo ApiDocs::blueprint()->render();
config/app.php
bash
php artisan vendor:publish --provider="Yaro\ApiDocs\ServiceProvider"
config/filesystems.php
bash
php artisan apidocs:blueprint-create