PHP code example of swisnl / openapi-spec-generator

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

    

swisnl / openapi-spec-generator example snippets


php artisan vendor:publish --provider="LaravelJsonApi\OpenApiSpec\OpenApiServiceProvider"

php artisan jsonapi:openapi:generate v1
 php
class Post extends Schema implements DescribesEndpoints
{
    public function describeEndpoint(string $endpoint) {
        if ($endpoint === 'v1.posts.index') {
            return 'Description for index method';
        }

        return 'Default description';
    }
}