PHP code example of ronu / laravel-openapi-generator

1. Go to this page and download the library: Download ronu/laravel-openapi-generator 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/ */

    

ronu / laravel-openapi-generator example snippets


return [
    'api_types' => [
        'admin' => [
            'prefix' => 'admin',
            'folder_name' => 'API Admin',
            'enabled' => true,
        ],
        'mobile' => [
            'prefix' => 'mobile',
            'folder_name' => 'API Mobile',
            'enabled' => true,
        ],
    ],
    'routes' => [
        'enabled' => true,
        'prefix' => 'documentation',
        'middleware' => [],
    ],
];

// config/openapi-docs.php
'custom_endpoints' => [
    'api-apps.rotate' => [
        'summary' => 'Rotate API Key',
        'description' => 'Generates a new API key for the application.',
        'request_fields' => [
            'reason' => 'Optional reason for key rotation',
        ],
    ],
],
bash
php artisan vendor:publish --tag=openapi-config
bash
php artisan vendor:publish --tag=openapi-templates
bash
php artisan openapi:generate