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

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

cm2-tech/swagger-bundle
=======================

Reusable Symfony bundle for generating OpenAPI (Swagger) JSON output with basic protection

1.0.8(11mo ago)0137MITPHPPHP &gt;=8.1

Since May 27Pushed 11mo agoCompare

[ Source](https://github.com/CM2-Tech/swagger-bundle)[ Packagist](https://packagist.org/packages/cm2-tech/swagger-bundle)[ RSS](/packages/cm2-tech-swagger-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (10)Used By (0)

CM2 Swagger Bundle
==================

[](#cm2-swagger-bundle)

Bundle para gerar e servir automaticamente a documentação OpenAPI (`swagger.json`) com base em anotações do pacote [`zircote/swagger-php`](https://github.com/zircote/swagger-php), para projetos Symfony.

Instalação
----------

[](#instalação)

1. Adicione o bundle via `composer`:

composer require cm2-tech/swagger-bundle:^1.0

2. Habilite o bundle (se necessário):

Symfony Flex já deve fazer isso automaticamente. Caso contrário, edite config/bundles.php:

return \[ // ... CM2\\SwaggerBundle\\CM2SwaggerBundle::class =&gt; \['all' =&gt; true\], \];

3. Adicione a variável de ambiente SWAGGER\_TOKEN no seu arquivo .env ou .env.local:

SWAGGER\_TOKEN=seu\_token\_secreto

Esta variável é obrigatória para proteger o acesso ao endpoint /\_swagger. Sem ela, o acesso será negado.

4. Importe os endpoints do bundle, só tem 1 (/\_swagger):

swagger\_bundle: resource: '@SwaggerBundle/Controller/' type: annotation

5. O controller precisa de argumentos, importe-os no services.yaml:

services: CM2\\SwaggerBundle\\Controller\\SwaggerController: arguments: $sources: - '%kernel.project\_dir%/src/Controller' - '%kernel.project\_dir%/src/Entity' tags: \['controller.service\_arguments'\]

Uso
---

[](#uso)

Acesse a URL:

/\_swagger?token=seu\_token\_secreto

Ela retornará o conteúdo do swagger.json com base nas anotações presentes em:

- src/Controller
- src/Entity

Requisitos
----------

[](#requisitos)

- PHP &gt;= 8.1
- Symfony &gt;= 6.4
- zircote/swagger-php

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance50

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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 ~0 days

Total

9

Last Release

356d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0439afc20c96837776370d674bce74a7df92f8eabcd351745d3357deec184c79?d=identicon)[cm2tech](/maintainers/cm2tech)

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k34.0M112](/packages/darkaonline-l5-swagger)[cravler/maxmind-geoip-bundle

Bundle integrating MaxMind GeoIP2 database into symfony application

27615.8k2](/packages/cravler-maxmind-geoip-bundle)[sulu/headless-bundle

Bundle that provides controllers and services for using Sulu as headless content management system

55133.7k2](/packages/sulu-headless-bundle)[tobion/openapi-symfony-routing

Loads routes in Symfony based on OpenAPI/Swagger annotations

4219.5k](/packages/tobion-openapi-symfony-routing)[litalico-engineering/eg-r2

Easy request validation and route generation from open API specifications (for Laravel)

1112.5k](/packages/litalico-engineering-eg-r2)

PHPackages © 2026

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