This branch uses Swagger-spec 2.0 and Swagger-php 2.0. This branch also updates the Swagger-ui to version 2.1.4.
This fork updates Swagger-ui to 2.1.4 and changes the apiKey authentication scheme to a JsonWebToken (JWT) scheme. It adds a username + password field which if authenticated sets the token returned and passes it as "Bearer + token" on each request in headers.
It expects a SecurityScheme like this:
@SWG\SecurityScheme(
securityDefinition="JsonWebToken",
type="apiKey",
authorizationUrl="http://my.api.io/v1/login",
in="header",
name="Authorization"
)
Please note that even though the input field is named username
its actually passed to the server as email
. You can easily change this in AuthView.js
.
The Swagger-ui was changed to allow inserting the OAuth 2 parameters (client_id
, client_secret
, realm
and appName
) directly in the ui.
You can also pass these values in the url in the URL, like so:
http://api.appcursos.com/api-docs?client_id=my-client-id&client_secret=my-client-secret&realm=my-realm&appName=my-app-name
To use Swaggervel for Laravel 4.2, use the version 1.0 branch (https://github.com/slampenny/Swaggervel/tree/1.0)
Swagger for Laravel
This package combines Swagger-php and swagger-ui into one Laravel-friendly package.
When you run your app in debug mode, Swaggervel will scan your app folder (or any folder that is set under the "app-dir" variable in the packages config), generate swagger json files and deposit them to the doc-dir folder (default is /docs
). Files are then served by swagger-ui under the api-docs director.
- Add
Jlapp\Swaggervel\SwaggervelServiceProvider
to your providers array inapp/config/app.php
above your route provider, to avoid any catch-all routes - Run
php artisan vendor:publish
to push swagger-ui to your public folder.
- www.example.com/docs <- swagger JSON files are visible
- www.example.com/api-docs <- swagger ui is visible.
Uncomment the "viewHeaders" option in the Config file to add headers to your view.