PHPackages                             kleijnweb/symfony-swagger-microservice-edition - 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. kleijnweb/symfony-swagger-microservice-edition

AbandonedArchivedProject[API Development](/categories/api)

kleijnweb/symfony-swagger-microservice-edition
==============================================

Symfony edition for "interface first" microservices that's as lean and mean as it is unofficial.

543[2 issues](https://github.com/kleijnweb/symfony-swagger-microservice-edition/issues)PHP

Since Jan 31Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kleijnweb/symfony-swagger-microservice-edition)[ Packagist](https://packagist.org/packages/kleijnweb/symfony-swagger-microservice-edition)[ RSS](/packages/kleijnweb-symfony-swagger-microservice-edition/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

This project is no longer maintained
====================================

[](#this-project-is-no-longer-maintained)

Symfony Swagger Microservice Edition [![Build Status](https://camo.githubusercontent.com/fddbd772d18c5553f45ee7d51495f69843cc11a6500e4da2cbd39e65cb57ace0/68747470733a2f2f7472617669732d63692e6f72672f6b6c65696a6e7765622f73796d666f6e792d737761676765722d6d6963726f736572766963652d65646974696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kleijnweb/symfony-swagger-microservice-edition)
==============================================================================================================================================================================================================================================================================================================================================================================================================

[](#symfony-swagger-microservice-edition-)

Symfony edition for "interface first" microservices that's as lean and mean as it is unofficial.

For a more complete example, have a look at [swagger-bundle-example](https://github.com/kleijnweb/swagger-bundle-example).

Lean
----

[](#lean)

The Symfony Standard Editions bundles no less than 125MB worth of bytes. This edition comes in at 32MB (both installed with --no-dev). Components are cherry picked from Symfony, instead of including the whole framework with all the trimmings and then some 3rd part stuff\*.

*Less is more*. An nginx config template reflecting this philosophy is included.

**\* NOTE:** The symfony/framework bundle adds plenty of unneeded dependencies. Without them, this edition comes in at around 15MB (see [this issue](https://github.com/symfony/symfony/issues/15748)).

Mean
----

[](#mean)

This edition uses [kleijnweb/swagger-bundle](https://github.com/kleijnweb/swagger-bundle) to integrate routing and input validation from Swagger into Symfony. On top of its (very modest) dependencies, this edition only adds [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv). Monolog is added as the logger, as SwaggerBundle will work with any PSR logger and depends only on the interface package.

This package only uses the minimal capabilities of SwaggerBundle. Refer to [kleijnweb/swagger-bundle](https://github.com/kleijnweb/swagger-bundle) for an overview of implementation options.

Unofficial
----------

[](#unofficial)

I am not affiliated with SensioLabs in any way, and not particularly connected to the Symfony community. This is anarchy city, beware.

Quick Start
-----------

[](#quick-start)

1. `composer install`
2. Rename `.env.dist` to `.env`
3. Confirm all is good to start screwing things up: `phpunit -c app`
4. Replace `app/config/swagger.yml` with your own Swagger
5. Start hacking away at the pet store :)

**Note:** To change the root namespace from Acme to your own, update composer.json autoload config and `install`.

Docker
------

[](#docker)

To follow this section your need [Docker](http://docs.docker.com/) installed. This one-liner should do the trick:

```
curl -sSL https://get.docker.com/ | sh
```

Want awesomeness without delay? Then `./kickstart.sh` first, ask questions later.

### PHP 7.0 + FPM Docker container

[](#php-70--fpm-docker-container)

This runs pretty damn fast. A full round-trip will generally stay under 50ms (not accounting for initial cache warmup, external resources and varying hardware).

To build your app, run `docker build -t my-service-name .`. Edit php.ini if needed. Then run the container as a background process: `docker run -d my-service-name`. Now you can use any fcgi frontend, eg nginx.

### Redundant FCGI Service

[](#redundant-fcgi-service)

On a single server, load balancing using docker containers does not make much sense. But having a redundant setup not only protects you from downtime, it also makes for 0 downtime deployments.

Jason Wilder has created an easy to use lib that updates config when certain Docker events are triggered. You can use it to autoupdate your upstream fcgi server list in Nginx. Instructions:

If you haven't done so already, build your service image:

```
docker build -t my-service-name-v1 .
```

Create a default, dummy nginx config (it will be replaced as soon as docker-gen comes up):

```
echo 'events {
          worker_connections 1024;
      }' >  /tmp/nginx/nginx.conf
```

Run a standard nginx container, expose port 8000 to the host (80 if you prefer), but add its config directory as a volume:

```
docker run -d --name nginx -p 8000:80 -v /tmp/nginx:/etc/nginx -t nginx
```

Confirm the container is running (`docker ps`). Put bundled nginx.tmpl somewhere docker-gen can access it:

```
rm -rf /tmp/templates && mkdir /tmp/templates && cp nginx.tmpl /tmp/templates
```

**NOTE**: This nginx config has been pretty much stripped down to the necessities for running a microservice. You may want to edit it. Any containers exposing port 9000 will be added as upstream server using this template. Again, you may want to edit it.

Run a docker-gen container that'll monitor docker for changes in containers, and update the ngnix.conf.

```
docker run -d --name my-app-name-nginx-gen --volumes-from nginx  \
   -v /var/run/docker.sock:/tmp/docker.sock \
   -v /tmp/templates:/etc/docker-gen/templates \
   -t jwilder/docker-gen:0.3.4 -notify-sighup nginx -watch --only-exposed /etc/docker-gen/templates/nginx.tmpl /etc/nginx/nginx.conf
```

**NOTE**: If the container doesn't start, you probably edited the ngnix.tmpl and it has a parse error. Run without `-d` to debug.

To see the magic working, watch nginx.conf on the host system:

```
tail -n 50 /tmp/nginx/nginx.conf
```

Start running containers based on your service image:

```
docker run -d my-app-name-v1
docker run -d my-app-name-v1
docker run -d my-app-name-v1
```

The `upstream` section will look something like this:

```
upstream phpfpm_upstream {

    # kickass_payne
    server 172.17.1.108:9000;

    # backstabbing_yonath
    server 172.17.1.105:9000;

    # jovial_fermat
    server 172.17.1.97:9000;
}

```

Try stopping and starting containers to see the config being updated, eg `docker stop kickass_payne`.

You can test the demo API by requesting `http://127.0.0.1:8000/v2/pet/findByStatus?status=pending`.

Deploying a new version of your service could not be easier. Build the new version, then repeatedly stop an old and start a new container until all containers are replaced.

Enjoy :)

License
-------

[](#license)

MIT

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

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/cd6223a727c26ae6be208c1159924e9a2b43a9b11ae0da3afa1e641a49873fae?d=identicon)[kleijnweb](/maintainers/kleijnweb)

---

Top Contributors

[![johnknl](https://avatars.githubusercontent.com/u/8375560?v=4)](https://github.com/johnknl "johnknl (30 commits)")

### Embed Badge

![Health badge](/badges/kleijnweb-symfony-swagger-microservice-edition/health.svg)

```
[![Health](https://phpackages.com/badges/kleijnweb-symfony-swagger-microservice-edition/health.svg)](https://phpackages.com/packages/kleijnweb-symfony-swagger-microservice-edition)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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