2017 © Pedro PelĂĄez
 

library silex-simple-swagger-provider

A silex service provider that integrates swagger-php 2.0 into silex

image

basster/silex-simple-swagger-provider

A silex service provider that integrates swagger-php 2.0 into silex

  • Saturday, April 1, 2017
  • by Basster
  • Repository
  • 1 Watchers
  • 6 Stars
  • 22,941 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 6 Versions
  • 13 % Grown

The README.md

silex-simple-swagger-provider

Build Status Scrutinizer Code Quality Code Coverage, (*1)

silex-simple-swagger-provider is a silex service provider that integrates swagger-php (Version 2) into silex. This service provider adds routes for generating and exposing a swagger defintion based on swagger-php annotations. The swagger definition can then be used with swagger-ui., (*2)

This library is strongly inspired by Jason Desrosiers silex-swagger-provider but fully rewritten to meet the needs of swagger-php (Version 2), (*3)

:warning: For Silex2 and Pimple3 check out the silex-2 branch :warning:, (*4)

Installation fĂŒr Silex 1

Install the silex-swagger-provider using composer., (*5)

composer require basster/silex-simple-swagger-provider:^1.0

Parameters

  • swagger.servicePath: The path to the classes that contain your swagger annotations.
  • swagger.excludePath: A string path or an array of paths to be excluded when generating annotations.
  • swagger.apiDocPath: The URI that will be used to access the swagger definition. Defaults to /api/api-docs.
  • swagger.cache: An array of caching options that will be passed to Symfony 2's Response::setCache method.

Services

  • swagger: An instance of Swagger\Annotations\Swagger. It's the already parsed swagger annotation tree.

Registering

$app->register(new Basster\Silex\Provider\Swagger\SwaggerProvider(), [
    "swagger.servicePath" => __DIR__ . "/path/to/your/api",
]);

Usage

The following routes are made available by default * GET /api/api-docs: Get the list of resources, (*6)

The results of the swagger definition file is not cached internally. Instead, the routes that are created are designed to work with an HTTP cache such as a browser cache or reverse proxy. You can configure how you want to your service cached using the swagger.cache parameter. By default, no caching will be done. Read about HTTP caching in Symfony for more information about how to customize caching behavior. The following example will allow the service definition file to be cached for 5 days., (*7)

$app["swagger.cache"] = [
    "max_age": "432000", // 5 days in seconds
    "s_maxage": "432000", // 5 days in seconds
    "public": true,
]

The Versions

01/04 2017

dev-master

9999999-dev

A silex service provider that integrates swagger-php 2.0 into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ole RĂ¶ĂŸner

service silex swagger provider swagger-ui

01/04 2017

dev-silex-2

dev-silex-2

A silex service provider that integrates swagger-php 2.0 into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ole RĂ¶ĂŸner

service silex swagger provider swagger-ui

08/06 2016

2.0

2.0.0.0

A silex service provider that integrates swagger-php 2.0 into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ole RĂ¶ĂŸner

service silex swagger provider swagger-ui

21/04 2016

1.0.2

1.0.2.0

A silex service provider that integrates swagger-php 2.0 into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ole RĂ¶ĂŸner

service silex swagger provider swagger-ui

21/04 2016

1.0.1

1.0.1.0

A silex service provider that integrates swagger-php 2.0 into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ole RĂ¶ĂŸner

service silex swagger provider swagger-ui

21/04 2016

1.0

1.0.0.0

A silex service provider that integrates swagger-php 2.0 into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ole RĂ¶ĂŸner

service silex swagger provider swagger-ui