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

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

cethyworks/swagger-tools-bundle
===============================

Doctrine entities, controllers &amp; access-control file generators based on Swagger documents.

08PHP

Since Apr 14Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Cethy/SwaggerToolsBundle)[ Packagist](https://packagist.org/packages/cethyworks/swagger-tools-bundle)[ RSS](/packages/cethyworks-swagger-tools-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Cethyworks\\SwaggerToolsBundle
==============================

[](#cethyworksswaggertoolsbundle)

Development tools for [kleijnweb/swagger-bundle](https://github.com/kleijnweb/swagger-bundle)

Doctrine entities, controllers &amp; access-control file generators based on Swagger documents.

Install
-------

[](#install)

```
$ composer require cethyworks-swagger-tools-bundle
```

*Needs kleijnweb/swagger-bundle to be configured.*

Commands
--------

[](#commands)

### Doctrine Entities Generator

[](#doctrine-entities-generator)

```
$ app/console swagger:generate:entities swagger.yml HelloApiBundle
```

This command auto-generate doctrine entities based on Swagger file resource definitions.

The resulting entities contains `@ORM\` &amp; `@Assert\` annotations (@see Supported Swagger Properties below).

See `swagger:generate:entities --help` for more details.

#### Id

[](#id)

The id attribute is forced to a guid format &amp; UUID strategy.

#### Relations

[](#relations)

The generator does not support relations.

### Controllers Generator

[](#controllers-generator)

```
$ app/console swagger:generate:controllers swagger.yml HelloApiBundle
```

This command auto-generate Controller classes (and corresponding ControllerTest classes) based on the Swagger file paths definitions and register them as services (as needed by `kleijnweb/swagger-bundle`).

The resultant classes contains all the methods declared and matches the routing generated by `kleijnweb/swagger-bundle`.

**How it works (internal behavior) :**

- lists sf2 routes (needs SwaggerBundle working)
- extracts `^swagger.{documentName}.{resource}.*.{action}$` from routes
- build `{resource}Controller.php` with `{action(s)}` methods
- register `swagger.controller.{resource}` service

See `swagger:generate:controllers --help` for more details.

### Role Based Access Control Configuration Generator

[](#role-based-access-control-configuration-generator)

```
$ app/console swagger:generate:access-control swagger.yml HelloApiBundle
```

This command auto-generate access-control configuration files based on the Swagger file paths/security definitions and register them in `config/security.yml`.

See `swagger:generate:access-control --help` for more details.

### Supported Swagger Properties

[](#supported-swagger-properties)

- readOnly
- required\* (Assert)
- x-required\* (Assert)
- minLength/maxLength (Assert)
- minimum/maximum (Assert)
- minItems/maxItems (Assert)
- enum (Assert)
- type (Assert)
- pattern (Assert)
- format{date\*,date-time\*,email,uuid,url, custom\*}\* (Assert)
- x-parent\*
- x-exclude\*
- x-serializer-exclude\*
- x-unique\*

#### `required` &amp; `x-required`

[](#required--x-required)

`required` is used by the swagger validator in `KleijnWeb\SwaggerBundle\Test\ApiTestCase`, `x-required` is only used by the generator.

Required properties are defined as an array &amp; at the root level, eg :

```
definitions:
  User:
    type: object
    required: ['firstName', 'lastName']
    x-required: ['id']
    properties:
      id:
        type: string
      firstName:
        type: string
      email:
      	type: string
      comment:
      	type: string
      	format: text
```

#### `format`

[](#format)

Swagger allow any string as format's value, Use it to add your custom Constraints.

example : `format: "AppBundle\Validator\Constraints\MyCustomConstraint"`

##### `type: string & format: text`

[](#type-string--format-text)

The generator recognize type: string w/ format: text as a doctrine type text.

#### `x-parent`

[](#x-parent)

Custom swagger property providing the means to declare a parent class to the entity generated.

#### `x-repository`

[](#x-repository)

Custom swagger property providing the means to declare a doctrine repository class to the entity generated.

#### `x-exclude`

[](#x-exclude)

Custom swagger property ; The generator will ignore definitions with `x-exclude: false`.

#### `x-serializer-exclude`

[](#x-serializer-exclude)

Custom swagger property ; The generator will set a `@exclude` in the entity for the Serializer.

#### `x-unique`

[](#x-unique)

Custom swagger property ; The generator will set this property into `@UniqueEntity`.

### Todo

[](#todo)

- Handle one2one relations
- Handle many2many relations
- Handle some basic behavior (timestampable)
- Add `Request $request` on put/post&amp;delete (or detect if paramType body)
- exclude.yml file
- -f/--force instead of -f=true
- handle [Swagger inheritance](https://github.com/OAI/OpenAPI-Specification/blob/master/fixtures/v2.0/json/models/modelWithComposition.json) with allOf

### License

[](#license)

MIT License

### Inspiration

[](#inspiration)

[KleijnWeb\\SwaggerBundle](https://github.com/kleijnweb/swagger-bundle) &amp; [KleijnWeb\\SwaggerBundleTools](https://github.com/kleijnweb/swagger-bundle-tools)

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

[![Cethy](https://avatars.githubusercontent.com/u/735030?v=4)](https://github.com/Cethy "Cethy (26 commits)")

### Embed Badge

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

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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