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
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
- Manage most used end points like:
- page
- index
- store
- show
- delete
- update
- restore
- force delete
- security is optional
- suggestion to the expected route path or can enter it
- detect the params from the given route path
- handle sorting, pagination length, search
- generate separate file for the given model for all above opetations
- support json and yaml
- can extend the above operations and add others
- have the route
/documentation
to view the generated docs - supportes to multiple servers url from the config file
swagger-builder.php
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.