PHP code example of creatify / swagger-builder

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

    

creatify / swagger-builder example snippets


# register the package service provider in config/app.php in providers array

Creatify\SwaggerBuilder\Providers\SwaggerBuilderServiceProvider::class,

# publish the needed files

php artisan vendor:publish --provider="Creatify\SwaggerBuilder\Providers\SwaggerBuilderServiceProvider"

php artisan vendor:publish --tag=swagger-builder

php artisan swagger:build




return [

    'schema' => [
        'id' => 'integer',
        'name' => 'string',
        'description' => 'string'
    ],

    'store' => [
        'name' => 'string',
        'description' => 'string'
    ],

    'update' => [
        'name' => 'string',
        'description' => 'string'
    ]
];

#schema represent the single response object of your model
#store contains the needed data to store new model (store method request body)
#update contains the needed data to update existing model (update method request body)

#start generating 
php artisan swagger:generate
txt
# make new php file which represents your endpoints with the below structure