Swagger 2.0 for Laravel 5
This package is a copy of Swaggervel adapted to work with Laravel 5 with several tweaks.
For Swagger 2.0
composer require darkaonline/l5-swagger ~2.0
For Swagger 1.0
composer require darkaonline/l5-swagger ~0.1
- Open your
AppServiceProvider
(located inapp/Providers
) and add this line inregister
function
$this->app->register('Darkaonline\L5Swagger\L5SwaggerServiceProvider');
the final function should similar to this:
public function register()
{
$this->app->bind(
'Illuminate\Contracts\Auth\Registrar',
'App\Services\Registrar'
);
//Register Swagger Provider
$this->app->register('Darkaonline\L5Swagger\L5SwaggerServiceProvider');
}
- Run
php artisan l5-swagger:publish-assets
to publish swagger-ui your public folder (public/vendos/l5-swagger
)
- Run
l5-swagger:publish-config
to publish configs (config/l5-swagger.php
) - Run
l5-swagger:publish-assets
to publish swagger-ui to your public folder (public/vendos/l5-swagger
) - Run
l5-swagger:publish-views
to publish views (resources/views/vendor/l5-swagger
) - Run
l5-swagger:publish
to publish everything - Run
l5-swagger:generate
to generate docs
The actual Swagger spec is beyond the scope of this package. All L5-Swagger does is package up swagger-php and swagger-ui in a Laravel-friendly fashion, and tries to make it easy to serve. For info on how to use swagger-php look here. For good examples of swagger-php in action look here.