PHPackages                             swaggest/swac - 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. swaggest/swac

ActiveTool[API Development](/categories/api)

swaggest/swac
=============

Swagger/OpenAPI code generator

v0.1.35(2y ago)10953[5 issues](https://github.com/swaggest/swac/issues)[1 PRs](https://github.com/swaggest/swac/pulls)MITPHP

Since Oct 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/swaggest/swac)[ Packagist](https://packagist.org/packages/swaggest/swac)[ RSS](/packages/swaggest-swac/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (40)Used By (0)

OpenAPI 3.0 / Swagger 2.0 compiler
==================================

[](#openapi-30--swagger-20-compiler)

A tool to render API spec as code.

[![Build Status](https://camo.githubusercontent.com/fcac66db8f52003dfba993b355b40325eabbdc3b3ba73da86f9f356afd867c58/68747470733a2f2f7472617669732d63692e6f72672f73776167676573742f737761632e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/swaggest/swac)[![codecov](https://camo.githubusercontent.com/a928df5c6b1d9f31fd97a5026dfd60bac5cc3e845a0cd5895a4e959085430e8b/68747470733a2f2f636f6465636f762e696f2f67682f73776167676573742f737761632f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/swaggest/swac)[![Image Size](https://camo.githubusercontent.com/dc7ac7937d8c9d9e61bee6f347fa2c7fa14bc7926190d49efa6b04ec35219163/68747470733a2f2f696d616765732e6d6963726f6261646765722e636f6d2f6261646765732f696d6167652f73776167676573742f737761632e737667)](https://microbadger.com/images/swaggest/swac)[![Code lines](https://camo.githubusercontent.com/2ae9f33ed6993874ae7313f8c77139e38cf6e22ebeec5876abc77f7baf7e2316/68747470733a2f2f736c6f632e78797a2f6769746875622f73776167676573742f737761632f3f63617465676f72793d636f6465)](https://camo.githubusercontent.com/2ae9f33ed6993874ae7313f8c77139e38cf6e22ebeec5876abc77f7baf7e2316/68747470733a2f2f736c6f632e78797a2f6769746875622f73776167676573742f737761632f3f63617465676f72793d636f6465)[![Comments](https://camo.githubusercontent.com/a044b992da619a447e90e865088ccf5ba55609592c141e53285529c05afbe141/68747470733a2f2f736c6f632e78797a2f6769746875622f73776167676573742f737761632f3f63617465676f72793d636f6d6d656e7473)](https://camo.githubusercontent.com/a044b992da619a447e90e865088ccf5ba55609592c141e53285529c05afbe141/68747470733a2f2f736c6f632e78797a2f6769746875622f73776167676573742f737761632f3f63617465676f72793d636f6d6d656e7473)

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

[](#installation)

### Phar

[](#phar)

Download `swac` from [releases](https://github.com/swaggest/swac/releases) page.

### Docker

[](#docker)

```
docker run --rm swaggest/swac swac --help
```

```
v0.1.28 swac
OpenAPI/Swagger compiler, https://github.com/swaggest/swac
Usage:
   swac
   action   Action name
            Allowed values: php-guzzle-client, go-client, js-client, markdown
...

```

Example

```
mkdir petstore && cd petstore
docker run -v $(pwd):/code -u 1000:1000 swaggest/swac swac php-guzzle-client https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/json/petstore.json --namespace MyApp\\Petstore
```

Schema can be passed by STDIN using `-` as file path.

```
cat ./openapi.json | docker run -i --rm swaggest/swac swac markdown -
```

### Composer

[](#composer)

[Install PHP Composer](https://getcomposer.org/doc/00-intro.md)

```
composer global require swaggest/swac
```

Usage
-----

[](#usage)

### PHP Client

[](#php-client)

```
swac php-guzzle-client --help

```

```
v0.1.0 swac php-guzzle-client
OpenAPI/Swagger compiler, https://github.com/swaggest/swac
Usage:
   swac php-guzzle-client  --namespace
   schemaPath   Path/URL to OpenAPI/Swagger schema

Options:
   --operations       Operations filter in form of comma-separated list of method/path, default empty
   --project-path    Path to project root, default ./
   --namespace         Project namespace

```

The generated client depends on [`swaggest/rest-client`](https://github.com/swaggest/php-rest-client), `guzzlehttp/guzzle` 6, and [`swaggest/json-schema`](https://github.com/swaggest/php-json-schema).

[Examples](/examples/php-guzzle-client).

### Go Client

[](#go-client)

```
swac go-client --help

```

```
v0.1.14 swac go-client
OpenAPI/Swagger compiler, https://github.com/swaggest/swac
Usage:
   swac go-client
   schemaPath   Path/URL to OpenAPI/Swagger schema

Options:
   --operations                Operations filter in form of comma-separated list of method/path, default empty
   --out                              Path to output package, default ./client
   --pkg-name                     Output package name, default "client"
   --skip-default-additional-properties    Do not add field property for undefined `additionalProperties`
   --skip-do-not-edit                      Skip adding "DO NOT EDIT" comments
   --add-request-tags                      Add field tags with name and location to request structure properties, e.g. 'ID int `query:"id"`'
   --show-const-properties                 Show properties with constant values, hidden by default
   --keep-parent-in-property-names         Keep parent prefix in property name, removed by default
   --ignore-nullable                       Add `omitempty` to nullable properties, removed by default
   --ignore-xgo-type                       Ignore `x-go-type` in schema to skip generation
   --with-zero-values                      Use pointer types to avoid zero value ambiguity
   --fluent-setters                        Add fluent setters to struct fields
   --ignore-required                       Ignore if property is required when deciding on pointer type or omitempty
   --renames                   Map of exported symbol renames, example From:To
   --with-tests                            Generate (un)marshaling tests for entities (experimental feature)
   --require-xgenerate                     Generate properties with `x-generate: true` only
   --validate-required                     Generate validation code to check required properties during unmarshal

```

[Examples](/examples/go-client).

The generated client is a single package without external dependencies.

### JavaScript Client

[](#javascript-client)

```
swac js-client --help

```

```
v0.1.21 swac js-client
OpenAPI/Swagger compiler, https://github.com/swaggest/swac
Usage:
   swac js-client
   schema   Path/URL to OpenAPI/Swagger schema

Options:
   --operations       Operations filter in form of comma-separated list of method/path, default empty
   --ignore-operation-id          Ignore operationId and always name operations using method and path
   --client-name      Name of generated client class, default APIClient
   --types-prefix    Prefix generated jsdoc class names
   --out                     Path to output files, default ./client
   --patches          JSON patches to apply to schema file before processing, merge patches are also supported

```

[Examples](/examples/js-client).

```
swac js-client openapi.json --out ./ --client-name Backend --types-prefix xh

```

The generated client is a ES5 class using `XMLHttpRequest` and `jsdoc` type definitions without external dependencies suitable for direct usage in browsers.

### Markdown

[](#markdown)

```
swac markdown --help

```

```
v0.1.24 swac markdown
OpenAPI/Swagger compiler, https://github.com/swaggest/swac
Usage:
   swac markdown
   schema   Path/URL to OpenAPI/Swagger schema

Options:
   --operations          Operations filter in form of comma-separated list of method/path, default empty
   --ignore-operation-id             Ignore operationId and always name operations using method and path
   --client-name         Name of generated client class, default APIClient
   --add-schema-url    Add schema link to the document
   --types-prefix       Prefix generated type names
   --out                        Path to output files, default ./client
   --patches             JSON patches to apply to schema file before processing, merge patches are also supported

```

[Examples](/examples/).

```
swac markdown openapi.json --out ./API-Docs.md --types-prefix xh

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 96.1% 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 ~43 days

Recently: every ~129 days

Total

38

Last Release

810d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/27acbd2504e91c838d403112493d8ae7b584c2d8d2f2ea7a9762ef764e35bc8c?d=identicon)[vearutop](/maintainers/vearutop)

---

Top Contributors

[![vearutop](https://avatars.githubusercontent.com/u/1381436?v=4)](https://github.com/vearutop "vearutop (74 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![cussrox](https://avatars.githubusercontent.com/u/42931691?v=4)](https://github.com/cussrox "cussrox (1 commits)")

---

Tags

client-libcodegengojavascriptopenapiphprest-apiswagger

### Embed Badge

![Health badge](/badges/swaggest-swac/health.svg)

```
[![Health](https://phpackages.com/badges/swaggest-swac/health.svg)](https://phpackages.com/packages/swaggest-swac)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M648](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

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

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k379.4k24](/packages/team-reflex-discord-php)[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)
