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

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

enneite/swagger-bundle
======================

Symfony bundle generator from swagger interface (yml or json)

0.3.0(10y ago)12442[1 issues](https://github.com/enneite/swagger-bundle/issues)PHPPHP &gt;=5.3.3

Since Oct 7Pushed 10y ago2 watchersCompare

[ Source](https://github.com/enneite/swagger-bundle)[ Packagist](https://packagist.org/packages/enneite/swagger-bundle)[ RSS](/packages/enneite-swagger-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (9)Versions (9)Used By (0)

Swagger Bundle for symfony 2
============================

[](#swagger-bundle-for-symfony-2)

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

[](#installation)

- Install this bundle with composer!

```
composer require enneite/swagger-bundle
```

- Edit your app/AppKernel.php to register the bundle in the registerBundles() method!
- Define the swagger generator parameters in parameters.yml :

```
swagger:
      config_file: '%kernel.root_dir%/config/swagger.json'
      routing: 'yaml' #yaml or annotation
      destination_bundle: 'MyAppBundle'
      destination_namespace: 'My\AppBundle'
```

Note:
-----

[](#note)

- **config\_file parameter :** the json swagger configuration file
- **routing parameter :** the type ou routing (yaml or annotation)
- **destination\_bundle parameter :** the bundle where the API models and controllers must be generated
- **detination\_namespace parameter :** the namespace used for the API PHP classes

If the "config\_file" parameter is not define, the bundle will search a file named swagger.json in the config directory (app/config). The routing tye by default is yaml The "destination" parameter is required.

Use
---

[](#use)

You generate the PHP classes for the API with a sf2 CLI :

```
php app/console swagger:generate
```

Controllers and swagger models:
-------------------------------

[](#controllers-and-swagger-models)

"*Controller/Api*" directory and "*Api/Model*" directory will be created in your bundle source. If you choose yaml config, an *"api\_routing.yml"* file will be created in your bundle configuration file.

Security definitions:
---------------------

[](#security-definitions)

If you have defined security definitions in swagger, a file named "\_\_api\_security.yml.template" will be created in your "app/config" directory.

**WARNING:** symfony2 security configuration have to be loaded in an unique file, the consequence is that you have to copy/paste the content of the "\_api\_security.yml.template" in your security.yml file.
Authenticator services based on "Enneite\\Swagger\\Security\\ApiAuthenticator" will be registered dynamically but you have to implement your own providers. To work, the attribute "name" and the attribute "in" have to be filled for each security definition.

If your swagger file look like this:

```
swagger: '2.0'
info:
  version: "1.0"
  title: My app
host: www.myapp.com
basePath: /api
security:
       - ep_auth:
         - application:all

securityDefinitions:
  app_auth:
    description: Authentication
    type: oauth2
    in: header
    name: Authorization
    flow: password
    scopes:
      application:all: Authentification for all paths in api
    tokenUrl: http://www.my-api-oauth-provider/oauth
```

Your security.yml contents have to look like this:

```
security:

    providers:
        api_app_auth:
          id: app.user_provider # your user provider service ID (you have to implement it)
        in_memory:
            memory: ~

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt|error)|css|images|js)/
            security: false

        api_base_path:
              stateless: true
              pattern: ^/api
              simple_preauth:
                provider: api_app_auth
                authenticator: enneite_swagger.api_autenticator_app_auth #generated dynamically in swagger bundle

        main:
            anonymous: ~
```

Note:
-----

[](#note-1)

You can upgrade the API code too with the same command:

Models will be regenerated New controllers and new methods will be created. Warning: If you choose yaml config, an *"api\_routing.yml"* file will be regenaratedd in your bundle configuration file. Warning :old controllers and methods will NOT BE removed!

Unit Tests
----------

[](#unit-tests)

Run unit tests like this:

```
./vendor/bin/phpunit ./Tests
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~12 days

Total

4

Last Release

3885d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e87606c5102c05bfbe083daf5bf5c1d0addf9ade6a9c3720cbc84fb82e90fc9e?d=identicon)[enneite](/maintainers/enneite)

---

Top Contributors

[![enneite](https://avatars.githubusercontent.com/u/5436394?v=4)](https://github.com/enneite "enneite (3 commits)")[![bersiroth](https://avatars.githubusercontent.com/u/6897865?v=4)](https://github.com/bersiroth "bersiroth (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[sylius/sylius

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

8.5k5.9M737](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k13.0M218](/packages/simplesamlphp-simplesamlphp)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)

PHPackages © 2026

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