weburnit/swaggeravel

This package allows you to: generate RESTful API document using Swagger PHP.

1.0 2017-07-12 12:07 UTC

This package is auto-updated.

Last update: 2024-03-29 03:44:28 UTC


README

Software License

This package is a wrapper of Swagger-php and makes it easy to integrate with Lumen/Larvarel.

Usage

Installation

Via Composer

Add information about new package in your composer.json

    "repositories": [
        {
          "type": "vcs",
          "url": "git@gitlab.lzd.co:operations/laraswagger.git",
          "name": "lazada/database-minifier"
        }
    ],
    "require": {
        "lazada/laraswagger": ">=1.0.0"
    }

After the composer install finishes, register the service provider:

  • Lumen Application:
$app->register(Swagger\LaraSwagger\Providers\LumeSwaggerServiceProvider::class);
  • Laravel Application: not supports yet.

Now you can rock with LaraSwagger:

  • Run php artisan swagger:generate file_name [base_host]: to generate swagger api docs.

  • Go to /swagger/api-docs (default routing config) to see swagger api docs in JSON format

Default configuration

<?php
return [
    'routes' => [
        'prefix' => 'swagger'
    ],
    'api' => [
        'directories' => [base_path('app')],
        'excludes' => [],
        'host' => null
    ]
];

Customize configuration

In order to change default config you can copy the configuration template in config/lara-swagger.php to your application's config directory and modify according to your needs. For more information see the Configuration Files section in the Lumen documentation.

Tests

./vendor/phpunit/phpunit/phpunit

See test result at ./build