Download the PHP package savionicodemos/laravel-auto-swagger without Composer

On this page you can find all versions of the php package savionicodemos/laravel-auto-swagger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-auto-swagger

Laravel Auto Swagger Docs

Simple to use OAS3 compatible documentation generator.
Also includes Swagger UI.

About

This package is heavily inspired by the Mezatsong/laravel-swagger-docs.

The set of functions that this package has are included:

  1. OAS3 support (with constant verifications to ensure syntax and compatibility)
  2. Custom decorators
  3. Custom responses
  4. Custom Schemas
  5. Custom Schema builders
  6. Automatic Parameters generation based on path and Form Request classes
  7. Inclusion of Swagger UI with option to select between different UI drivers
  8. Automatic Schema generations by Models or custom Schema classes.
  9. Generate operation tags based on route prefix or controller's name

Installation

Install package through composer

Publish configuration files and views

Edit the swagger.php configuration file for your liking

Usage

Laravel Auto Swagger Docs works based on recommended practices by Laravel. It will parse your routes and generate a path object for each one. If you inject Form Request classes in your controller's actions as request validation, it will also generate the parameters for each request that has them. For the parameters, it will take into account wether the request is a GET/HEAD/DELETE or a POST/PUT/PATCH request and make its best guess as to the type of parameter object it should generate. It will also generate the path parameters if your route contains them. Finally, this package will also scan any documentation you have in your action methods and add it as summary and description to that path, along with any appropriate annotations such as @deprecated.

One thing to note is this library leans on being explicit. It will choose to include keys even if they have a default. For example it chooses to say a route has a deprecated value of false rather than leaving it out. I believe this makes reading the documentation easier by not leaving important information out. The file can be easily cleaned up afterwards if the user chooses to leave out the defaults.

Command line

Generating the swagger documentation is easy, simply run php artisan swagger:generate in your project root. The output of the command will be stored in your storage path linked in config file.

If you wish to generate docs for a subset of your routes, you can pass a filter using --filter, for example: php artisan swagger:generate --filter="/api"

You can also configure your swagger.php file to always generate schema when accessing Swagger UI or just by adding this line in your .env: SWAGGER_GENERATE_ALWAYS=true

By default, laravel-swagger prints out the documentation in json format, if you want it in YAML format you can override the format using the --format flag. Make sure to have the yaml extension installed if you choose to do so.

Format options are:

Annotations syntax

The annotations are written in the PHPDoc block of your controller methods. The syntax is as follows:

The syntax is basically a JSON inside a comment block. Just be aware to follow strictly the JSON syntax.

Rules

@Request() decorator

You can have only one @Request() decorator.

@Response() decorator

You can have multiple @Response decorators

[!NOTE] You can see all available schema builder or create your own schema builder, explore swagger.schema_builders config for more information

Custom Validators

These validators are made purely for visual purposes, however, some of them can actually do validation. But where to insert it? You can simply insert it in the rules array in your Form Request class like a normal Laravel validation.

swagger_default

It sets the default value for the parameter in the documentation

swagger_example

It sets the example value for the parameter in the documentation

[!NOTE] The difference between swagger_default and swagger_example is that swagger_default will inform to the user that this value is the default value for this parameter inside the application. swagger_example will just illustrate an example of how the parameter should be filled.

swagger_description

It sets the description for the parameter in the documentation

swagger_min

swagger_max


All versions of laravel-auto-swagger with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4 || 8.*
doctrine/dbal Version *
phpdocumentor/reflection-docblock Version ^5.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package savionicodemos/laravel-auto-swagger contains the following files

Loading the files please wait ....