Download the PHP package ronasit/laravel-swagger without Composer

On this page you can find all versions of the php package ronasit/laravel-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?
ronasit/laravel-swagger
Rate from 1 - 5
Rated 1.00 based on 1 reviews

Informations about the package laravel-swagger

Laravel Swagger plugin

Total Downloads Latest Stable Version License

Laravel Swagger Coverage Status

Comparison to another documentation generators

LaravelSwagger Scramble
Force developers to write tests :white_check_mark: :x:
Guarantee that API works :white_check_mark: :x:
Works with any route types covered by tests :white_check_mark: :x:
Generate response schema using JSON Resource class :x: :white_check_mark:
Runtime documentation generation :x: :white_check_mark:

Introduction

This plugin is designed to generate documentation for your REST API during the passing PHPUnit tests.

Installation

  1. Install the package using the following command: composer require ronasit/laravel-swagger

Note

For Laravel 5.5 or later the package will be auto-discovered. For older versions add the AutoDocServiceProvider to the providers array in config/app.php as follow:

  1. Run php artisan vendor:publish --provider=RonasIT\\AutoDoc\\AutoDocServiceProvider
  2. Add \RonasIT\AutoDoc\Http\Middleware\AutoDocMiddleware::class middleware to the global HTTP middleware list bootstrap\app.php:

  3. Add \RonasIT\AutoDoc\Traits\AutoDocTestCaseTrait trait to tests/TestCase.php
  4. Configure documentation saving using one of the next ways:

    • Add SwaggerExtension to the <extensions> block of your phpunit.xml. Please note that this way will be removed after updating PHPUnit up to 10 version (https://github.com/sebastianbergmann/phpunit/issues/4676)

    • Call php artisan swagger:push-documentation console command after the tests stage in your CI/CD configuration

Usage

Basic usage

  1. Create request class:

    Note

    For correct working of plugin you'll have to dispose all the validation rules in the rules() method of your request class. Also, your request class must be connected to the controller via dependency injection. Plugin will take validation rules from the request class and generate fields description of input parameter.

  2. Create a controller and a method for your route:

    Note

    Dependency injection of request class is optional but if it not presents, the "Parameters" block in the API documentation will be empty.

  3. Create test for API endpoint:

  4. Run tests
  5. Go to route defined in the auto-doc.route config
  6. Profit!

Annotations

You can use the following annotations in your request classes to customize documentation of your API endpoints:

Note

If you do not use request class, the summary and description and parameters will be empty.

Configs

Custom driver

You can specify the way to collect and view documentation by creating your own custom driver.

You can find example of drivers here.

Viewing OpenAPI documentation

As of version 2.2, the package includes the ability to switch between OpenAPI documentation viewers. To access different viewers, modify the documentation_viewer configuration. This change is reflected immediately, without the need to rebuild the documentation file.

Merging additional documentations

The package supports the integration of the primary documentation with additional valid OpenAPI files specified in the additional_paths configuration.

Migration guides

3.0.1-beta

Contributing

Thank you for considering contributing to Laravel Swagger plugin! The contribution guide can be found in the Contributing guide.

License

Laravel Swagger plugin is open-sourced software licensed under the MIT license.


All versions of laravel-swagger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^11.34
phpunit/phpunit Version ^11.4
ext-json Version *
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 ronasit/laravel-swagger contains the following files

Loading the files please wait ....