creatify/swagger-builder

There is no license information available for the latest version (2.0.0) of this package.

Generate Swagger Yaml And Json Files Based On Php Array

2.0.0 2023-05-01 20:11 UTC

This package is auto-updated.

Last update: 2025-06-26 17:11:26 UTC


README

pacakge

Swagger Builder

Generate awesome swagger docs for your apis from php array

Installation

Use the package manager composer to install foobar.

composer require creatify/swagger-builder

Usage

# 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
run the below command to start build your docs and select file format
php artisan swagger:build
# make new directory to save the php array which contain the structure of your endpoints
 by default the path in public/swagger/endpoints
# make new php file which represents your endpoints with the below structure
<?php

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
  1. Manage most used end points like:
  • page
  • index
  • store
  • show
  • delete
  • update
  • restore
  • force delete
  1. security is optional
  2. suggestion to the expected route path or can enter it
  3. detect the params from the given route path
  4. handle sorting, pagination length, search
  5. generate separate file for the given model for all above opetations
  6. support json and yaml
  7. can extend the above operations and add others
  8. have the route /documentation to view the generated docs
  9. supportes to multiple servers url from the config file swagger-builder.php

pacakge

pacakge

pacakge

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT