PHPackages                             nicofuma/swagger-bundle - 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. nicofuma/swagger-bundle

ActiveSymfony-bundle[API Development](/categories/api)

nicofuma/swagger-bundle
=======================

A bundle integrating swagger to validate Requests and Responses

1.0.7(9y ago)821.5k2[1 issues](https://github.com/Nicofuma/SwaggerBundle/issues)MITPHPPHP &gt;=5.6.0

Since Aug 26Pushed 9y ago3 watchersCompare

[ Source](https://github.com/Nicofuma/SwaggerBundle)[ Packagist](https://packagist.org/packages/nicofuma/swagger-bundle)[ RSS](/packages/nicofuma-swagger-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (9)Versions (13)Used By (0)

NicofumaSwaggerBundle
=====================

[](#nicofumaswaggerbundle)

[![Latest Stable Version](https://camo.githubusercontent.com/0892f555f319220efe666e310b86b938f69eed1a1b074e61fcfb1cceab4378ea/68747470733a2f2f706f7365722e707567782e6f72672f6e69636f66756d612f737761676765722d62756e646c652f762f737461626c652e706e67)](https://packagist.org/packages/nicofuma/swagger-bundle "Latest Stable Version")[![Latest Unstable Version](https://camo.githubusercontent.com/d1befe3b4cedf3016d7723094ab3ae86501c1aa36341096722a2b68f44830a82/68747470733a2f2f706f7365722e707567782e6f72672f6e69636f66756d612f737761676765722d62756e646c652f762f756e737461626c652e706e67)](https://packagist.org/packages/nicofuma/swagger-bundle "Latest Unstable Version")[![License](https://camo.githubusercontent.com/34956b3ed55242adb5d4559820aed93019931778faa6fb90339a594f90ef7877/68747470733a2f2f706f7365722e707567782e6f72672f6e69636f66756d612f737761676765722d62756e646c652f6c6963656e7365)](https://packagist.org/packages/nicofuma/swagger-bundle)[![Travis Build Status](https://camo.githubusercontent.com/410fedd3d207fb84a314fcf1debc5764b136bc2108844604a2fbdf8f8b925a45/68747470733a2f2f6170692e7472617669732d63692e6f72672f4e69636f66756d612f5377616767657242756e646c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/Nicofuma/SwaggerBundle "Build status")[![SensioLabsInsight](https://camo.githubusercontent.com/efec2287884f2eac5ff8a86c83881b7e94f5ab9bef9264bc9520744d5db56e89/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f63393630616663392d663637642d343634622d396330612d3335313836346538366537652f6d696e692e706e67)](https://insight.sensiolabs.com/projects/c960afc9-f67d-464b-9c0a-351864e86e7e "SensioLabsInsight")[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c28ef2960d6a0a9f36d660d0aec811dac54dcd19b1fcdbf50960dfdcd1203b98/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4e69636f66756d612f5377616767657242756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Nicofuma/SwaggerBundle/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/d9051909b3ee4094c854f706dda6851b42bc39183ec55f4a8ef5dfdcf3287c2a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4e69636f66756d612f5377616767657242756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Nicofuma/SwaggerBundle/?branch=master)

Description
-----------

[](#description)

This bundle integrates [Swagger](http://swagger.io/) in Symfony.

Currently, it supports the following features:

- Automatic validation of all incoming requests based on the Swagger definition (including headers and query string)
- Configuring multiple API with different swagger files using configuration
- FOSRestBundle integration: automatic configuration of the ParamFetcher
- Behat integration: context to validate the response

Installation
------------

[](#installation)

Add the required package using composer.

### Stable version

[](#stable-version)

```
composer require nicofuma/swagger-bundle:^1.0
```

### Bleeding-edge version

[](#bleeding-edge-version)

```
composer require nicofuma/swagger-bundle:@dev
```

### Enabling the bundle

[](#enabling-the-bundle)

Add the bundle to your AppKernel.

```
// in %kernel.root_dir%/AppKernel.php
$bundles = array(
    // ...
    new Nicofuma\SwaggerBundle\NicofumaSwaggerBundle(),
    // ...
);
```

Configuration
-------------

[](#configuration)

```
nicofuma_swagger:
    definition:
        pattern: '/api/v1'
        swagger_file: swagger/swagger.json
        strict: true
```

`pattern` any url matching this pattern will be tested against the `swagger_file``swagger_file` swagger file to use for this API. Can be either an bsolute path, a path relative to `%kernel.root_dir%/Resources/` or a bundle resource `@MyBundle/Dir/swagger.json``strict` whether or not an exception must be thrown if the path does not match any definition in the swagger file

Configuration reference
-----------------------

[](#configuration-reference)

```
# Default configuration for extension with alias: "swagger"
nicofuma_swagger:
    definitions:
        -
            pattern:
                # use the urldecoded format
                path:                 ^/api/public/
                host:                 null
                ips:                  []
                methods:              []
            swagger_file:         swagger-public.json
            strict:               true
        -
            pattern:
                # use the urldecoded format
                path:                 ^/api/private/
                host:                 null
                ips:                  []
                methods:              []
            swagger_file:         swagger-private.json
            strict:               true
```

Behat integration
-----------------

[](#behat-integration)

Add the following context in your behat.yml file

```
- Nicofuma\SwaggerBundle\Tests\Behat\Context\SwaggerContext: {map: '@swagger.validator_map'}

```

Contributing
------------

[](#contributing)

NicofumaSwaggerBundle is an open source project. If you'd like to contribute, please do.

License
-------

[](#license)

This library is under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 88.5% 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 ~23 days

Recently: every ~36 days

Total

8

Last Release

3379d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/10359f9e7830aeb3ded33b2c96e22b36728e7c5d2a052b08a91d00bd7ca15740?d=identicon)[Nicofuma](/maintainers/Nicofuma)

---

Top Contributors

[![Nicofuma](https://avatars.githubusercontent.com/u/591456?v=4)](https://github.com/Nicofuma "Nicofuma (23 commits)")[![alOneh](https://avatars.githubusercontent.com/u/758625?v=4)](https://github.com/alOneh "alOneh (3 commits)")

---

Tags

behatbundlephpswaggersymfonysymfony-bundle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nicofuma-swagger-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nicofuma-swagger-bundle/health.svg)](https://phpackages.com/packages/nicofuma-swagger-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M309](/packages/easycorp-easyadmin-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)

PHPackages © 2026

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