PHPackages                             basster/silex-simple-swagger-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. basster/silex-simple-swagger-provider

ActiveLibrary[API Development](/categories/api)

basster/silex-simple-swagger-provider
=====================================

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

2.0(10y ago)676.3k41MITPHPPHP &gt;=5.4

Since Apr 21Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Basster/silex-simple-swagger-provider)[ Packagist](https://packagist.org/packages/basster/silex-simple-swagger-provider)[ RSS](/packages/basster-silex-simple-swagger-provider/feed)WikiDiscussions silex-2 Synced 3w ago

READMEChangelogDependencies (3)Versions (6)Used By (1)

silex-simple-swagger-provider
=============================

[](#silex-simple-swagger-provider)

[![Build Status](https://camo.githubusercontent.com/13595d6995590b6e8c92dddfef6d8f1fd463c0b6db6cc60f5d0341a3dba2d08c/68747470733a2f2f7472617669732d63692e6f72672f426173737465722f73696c65782d73696d706c652d737761676765722d70726f76696465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Basster/silex-simple-swagger-provider)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9c980b85a1eeb274c818175ab08809a0f3325a2a7a4710502ed48051ce333e57/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f426173737465722f73696c65782d73696d706c652d737761676765722d70726f76696465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Basster/silex-simple-swagger-provider/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/219629e5a0e59b0e809fef028899bb7cf1c52c6c4824e376170f1c11dce05ce7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f426173737465722f73696c65782d73696d706c652d737761676765722d70726f76696465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Basster/silex-simple-swagger-provider/?branch=master)

[silex-simple-swagger-provider](https://github.com/Basster/silex-simple-swagger-provider) is a silex service provider that integrates [swagger-php](https://github.com/zircote/swagger-php) (Version 2) into [silex](https://github.com/fabpot/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](https://github.com/wordnik/swagger-ui).

This library is strongly inspired by Jason Desrosiers [silex-swagger-provider](https://github.com/jdesrosiers/silex-swagger-provider)but fully rewritten to meet the needs of [swagger-php](https://github.com/zircote/swagger-php) (Version 2)

Installation for Silex 2
------------------------

[](#installation-for-silex-2)

Install the silex-swagger-provider using [composer](http://getcomposer.org/).

```
composer require basster/silex-simple-swagger-provider:^2.0
```

Parameters
----------

[](#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
--------

[](#services)

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

Registering
-----------

[](#registering)

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

Usage
-----

[](#usage)

The following routes are made available by default

- `GET /api/api-docs`: Get the list of resources

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](http://symfony.com/doc/current/book/http_cache.html) 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.

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

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 58.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~16 days

Total

4

Last Release

3670d ago

Major Versions

1.0.2 → 2.02016-06-08

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1265783?v=4)[Ole Rößner](/maintainers/Basster)[@Basster](https://github.com/Basster)

---

Top Contributors

[![jdesrosiers](https://avatars.githubusercontent.com/u/716571?v=4)](https://github.com/jdesrosiers "jdesrosiers (32 commits)")[![Basster](https://avatars.githubusercontent.com/u/1265783?v=4)](https://github.com/Basster "Basster (18 commits)")[![andreiashu](https://avatars.githubusercontent.com/u/342638?v=4)](https://github.com/andreiashu "andreiashu (2 commits)")[![lkm](https://avatars.githubusercontent.com/u/1745971?v=4)](https://github.com/lkm "lkm (2 commits)")[![neurodesign](https://avatars.githubusercontent.com/u/1002428?v=4)](https://github.com/neurodesign "neurodesign (1 commits)")

---

Tags

swaggerserviceprovidersilexswagger-ui

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/basster-silex-simple-swagger-provider/health.svg)

```
[![Health](https://phpackages.com/badges/basster-silex-simple-swagger-provider/health.svg)](https://phpackages.com/packages/basster-silex-simple-swagger-provider)
```

###  Alternatives

[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k36.4M126](/packages/darkaonline-l5-swagger)[wotz/laravel-swagger-ui

Add Swagger UI to a Laravel application.

279385.0k](/packages/wotz-laravel-swagger-ui)[harmbandstra/swagger-ui-bundle

Exposes swagger UI inside your Symfony project through a route (eg. /docs)

40881.6k](/packages/harmbandstra-swagger-ui-bundle)[latrell/swagger

Swagger for Laravel 5

4163.0k](/packages/latrell-swagger)[ddesrosiers/silex-annotation-provider

A silex service provider that allows the use of annotations in ServiceControllers.

25249.1k3](/packages/ddesrosiers-silex-annotation-provider)[joy/voyager-api

This Laravel/Voyager module adds REST Api with swagger support to Voyager.

194.8k3](/packages/joy-voyager-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
