PHPackages                             systemsdk/docker-symfony-api - 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. [Database &amp; ORM](/categories/database)
4. /
5. systemsdk/docker-symfony-api

ActiveProject[Database &amp; ORM](/categories/database)

systemsdk/docker-symfony-api
============================

JSON REST API

v4.1.0(2w ago)624917MITPHPPHP ^8.5.0CI passing

Since Jan 15Pushed 2w ago7 watchersCompare

[ Source](https://github.com/systemsdk/docker-symfony-api)[ Packagist](https://packagist.org/packages/systemsdk/docker-symfony-api)[ Docs](https://github.com/systemsdk/docker-symfony-api)[ GitHub Sponsors](https://github.com/sponsors/systemsdk)[ Fund](https://opencollective.com/systemsdk-engineering)[ RSS](/packages/systemsdk-docker-symfony-api/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (183)Versions (52)Used By (0)

PHP Symfony environment with a JSON REST API
============================================

[](#php-symfony-environment-with-a-json-rest-api)

A scalable Docker-based environment (based on official PHP and MySQL Docker Hub repositories) required to run Symfony with a JSON REST APIs.

[![Actions Status](https://github.com/systemsdk/docker-symfony-api/workflows/Symfony%20Rest%20API/badge.svg)](https://github.com/systemsdk/docker-symfony-api/actions)[![CircleCI](https://camo.githubusercontent.com/5e34312d7c834502fb44c66d9b7cef3afa9ca91689313a89c0985f353a567750/68747470733a2f2f636972636c6563692e636f6d2f67682f73797374656d73646b2f646f636b65722d73796d666f6e792d6170692e7376673f7374796c653d737667)](https://circleci.com/gh/systemsdk/docker-symfony-api)[![Coverage Status](https://camo.githubusercontent.com/68c665fb8b6d9b7f8e931b9c484bac2395272bd4a3439ea5435d093d7d0194e1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73797374656d73646b2f646f636b65722d73796d666f6e792d6170692f62616467652e737667)](https://coveralls.io/github/systemsdk/docker-symfony-api)[![Latest Stable Version](https://camo.githubusercontent.com/cb2fd4d3bcc96c6f9966b369795fd8444872ce96387e3d78e23020b8be1a2590/68747470733a2f2f706f7365722e707567782e6f72672f73797374656d73646b2f646f636b65722d73796d666f6e792d6170692f76)](https://packagist.org/packages/systemsdk/docker-symfony-api)[![MIT licensed](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

[Source code](https://github.com/systemsdk/docker-symfony-api.git)

> This repository provides a basic (lite) DDD foundation and the standard core logic. If you are looking for a cleaner, pragmatic DDD architecture, a superior environment with robust core logic, and flawless documentation, we highly recommend our commercial product [Enterprise API](https://www.systemsdk.com/em_case_study/enterprise-api/).

Requirements
------------

[](#requirements)

- Docker Engine version 23.0 or later
- Docker Compose version 2.0 or later
- An editor or IDE
- MySQL Workbench

Note: We recommend using a Linux Ubuntu-based OS for the best experience.

Components
----------

[](#components)

**Core Stack**

- **PHP 8.5 FPM** - Main application runtime.
- **Symfony 7** - High-performance PHP framework for the REST API.
- **Nginx 1.29** - Web server and reverse proxy.

**Data &amp; Caching**

- **MySQL 8** - Primary relational database.
- **Redis 8** - In-memory data structure store and cache.

**Search &amp; Asynchronous Processing**

- **Elasticsearch 7** - Distributed search and analytics engine.
- **RabbitMQ 4** - Robust message broker for background jobs.

**Monitoring &amp; Development Tools**

- **Kibana 7** - Data visualization dashboard for Elasticsearch.
- **Mailpit** - Email testing tool (available in the development environment only).

Setting up Docker Engine &amp; Docker Compose
---------------------------------------------

[](#setting-up-docker-engine--docker-compose)

To install Docker Engine and Docker Compose, please follow the official [Docker Engine Installation Guide](https://docs.docker.com/engine/install/).

**For Linux Users:**After installation, run the following command to manage Docker as a non-root user (this allows you to run Docker without `sudo`):

```
sudo usermod -aG docker $USER
```

Note: You must log out and log back in for this change to take effect.

**For macOS Users:**If you are using Docker Desktop for macOS 12.2 or later, we highly recommend enabling [virtiofs](https://www.docker.com/blog/speed-boost-achievement-unlocked-on-docker-desktop-4-6-for-mac/) for a significant performance boost.

Note: Enabled by default since Docker Desktop v4.22.

Setting up the DEV environment
------------------------------

[](#setting-up-the-dev-environment)

1. You can clone this repository from GitHub or install via composer.

    If you have installed composer and want to install environment via composer you can use next cmd command:

    ```
    composer create-project systemsdk/docker-symfony-api api-example-app
    ```
2. Set a unique `APP_SECRET` for the application in `.env.prod` and `.env.staging` files.

    - **Secret Key**: You can generate a secure key by running: `openssl rand -hex 16` (do not use third-party websites for generating this value).
    - **Environment Files**: Do not use `.env.local.php` on dev and test environments (delete it if it exists).
    - **Custom Configs**: If you want to change default web port/xdebug configurations, you can create an `.env.local` file and override parameters there (see `.env` file).
    - **Database**: Delete the `var/mysql-data` folder if it exists before starting.
3. Verify that your local `hosts` file contains the default mapping for `localhost` (this is usually set by default in all operating systems):

    ```
    127.0.0.1    localhost

    ```

    Note: The file is located at `/etc/hosts` on Linux/macOS and `C:\Windows\System32\drivers\etc\hosts` on Windows.
4. Configure Xdebug (Optional)

    Depending on your operating system, you can customize Xdebug behavior by editing either `/docker/dev/xdebug-main.ini` (Linux/Windows) or `/docker/dev/xdebug-osx.ini` (macOS).

    - To debug every request (Default):

        This is the default setting. It will intercept and debug all incoming API requests.

        ```
        xdebug.start_with_request = yes
        ```
    - To debug only specific requests (On-Demand):

        If you prefer to trigger the debugger manually only when making requests from a browser frontend, change the configuration to:

        ```
        xdebug.start_with_request = no
        ```

        Tip: Install the "Xdebug helper" extension for Chrome or Firefox and set the IDE Key to `PHPSTORM` in the extension settings.
5. Elasticsearch &amp; Kibana Credentials

    Elasticsearch is pre-configured with a privileged bootstrap user. You can use these credentials to log into the Kibana dashboard:

    - **Username:** `elastic`
    - **Password:** `changeme`

    Security Note: You must use a strong, unique password for staging and production environments. Never use these default credentials outside of local development.
6. Build and Initialize the Environment

    Run the following commands in your terminal to build the Docker images, start the containers, install PHP dependencies and generate the JWT authentication keys:

    ```
    make build
    make start
    make composer-install
    make generate-jwt-keys
    ```
7. Apply Migrations and Configurations

    Execute the following commands to set up the database structure, initialize default user roles and groups, configure cron jobs, prepare message broker transports and apply Elasticsearch templates:

    ```
    make migrate
    make create-roles-groups
    make migrate-cron-jobs
    make messenger-setup-transports
    make elastic-create-or-update-template
    ```
8. Access Application Services

    Once the environment is successfully running, you can access the various services in your browser using the following URLs:

    - **API Documentation:**
    - **RabbitMQ Management:**
    - **Kibana Dashboard:**  (Use the credentials from Step 6)
    - **Mailpit (Debug Email):**

Setting up the STAGING environment locally
------------------------------------------

[](#setting-up-the-staging-environment-locally)

Important: This section describes how to set up the staging environment locally for debugging and verification purposes only. A real STAGING environment must be deployed on a dedicated server and should be as close to the PRODUCTION environment as possible.

Note: These steps assume you have already completed steps 1 through 3 of the "Setting up the DEV environment" section above.

1. Database Clean-up

    Delete the `var/mysql-data` folder if it exists before starting.
2. Elasticsearch &amp; Kibana Credentials

    Elasticsearch is pre-configured with a privileged bootstrap user. You can use these credentials to log into the Kibana dashboard:

    - **Username:** `elastic`
    - **Password:** `changeme`

    Security Note: You must use a strong, unique password for the real staging environment. Never use these default credentials outside of local development.
3. Build and Initialize the Environment

    Run the following commands in your terminal to build the staging Docker images, start the containers and generate the JWT authentication keys:

    ```
    make build-staging
    make start-staging
    make generate-jwt-keys
    ```

    Note: With `opcache.validate_timestamps=0` ([php.ini](docker/staging/php.ini)) enabled for performance, any manual file changes or code updates require a PHP-FPM restart/reload to take effect.
4. Apply Migrations and Configurations

    Execute the following commands to set up the database structure, initialize default user roles and groups, configure cron jobs, prepare message broker transports and apply Elasticsearch templates:

    ```
    make migrate-no-test
    make create-roles-groups
    make migrate-cron-jobs
    make messenger-setup-transports
    make elastic-create-or-update-template
    ```

Setting up the PROD environment locally
---------------------------------------

[](#setting-up-the-prod-environment-locally)

Important: This section describes how to set up the production environment locally for debugging and verification purposes only. A real PROD environment must be deployed on a dedicated server.

Note: These steps assume you have already completed steps 1 through 3 of the "Setting up the DEV environment" section above.

1. Database and RabbitMQ Clean-up

    Delete the `var/mysql-data`, `var/rabbitmq` and `var/elasticsearch-data/nodes` folders if they exist before starting.
2. Edit the `.env.prod` file and set a secure password for MySQL, as well as a username and password for RabbitMQ.
3. Elasticsearch &amp; Kibana Credentials

    Elasticsearch is pre-configured with a privileged bootstrap user. You can use these credentials to log into the Kibana dashboard:

    - **Username:** `elastic`
    - **Password:** `changeme`

    Security Note: You must use a strong, unique password for the real production environment. Never use these default credentials outside of local development.
4. Build and Initialize the Environment

    Run the following commands in your terminal to build the production Docker images, start the containers and generate the JWT authentication keys:

    ```
    make build-prod
    make start-prod
    make generate-jwt-keys
    ```

    Note: With `opcache.validate_timestamps=0` ([php.ini](docker/prod/php.ini)) enabled for performance, any manual file changes or code updates require a PHP-FPM restart/reload to take effect.
5. Apply Migrations and Configurations

    Execute the following commands to set up the database structure, initialize default user roles and groups, configure cron jobs, prepare message broker transports and apply Elasticsearch templates:

    ```
    make migrate-no-test
    make create-roles-groups
    make migrate-cron-jobs
    make messenger-setup-transports
    make elastic-create-or-update-template
    ```

Enabling Paid Features for Elasticsearch
----------------------------------------

[](#enabling-paid-features-for-elasticsearch)

To unlock Elasticsearch's paid features (for a 30-day trial), you need to modify its configuration file:

1. Open `/docker/elasticsearch/config/elasticsearch.yml`.
2. Change the value of the `xpack.license.self_generated.type` option from `basic` to `trial`.
3. Restart the environment to apply the changes.

Accessing Container Shells
--------------------------

[](#accessing-container-shells)

Once the application is running (via `make start`), you can easily access the command line inside your containers.

To open a shell inside the main **Symfony** container, run:

```
make ssh
```

You can also access the other services using the following commands:

```
make ssh-nginx
make ssh-supervisord
make ssh-mysql
make ssh-rabbitmq
```

Tip: Type `exit` and press Enter to leave the container's shell and return to your local terminal.

Rebuilding Containers
---------------------

[](#rebuilding-containers)

If you modify any `Dockerfile` or environment configurations, you will need to rebuild the containers using the following commands:

```
make down
make build
make start
```

Note: Use environment-specific commands if you need to rebuild the test, staging, or production environments. For a complete list of available commands, run `make help`.

Starting and Stopping Containers
--------------------------------

[](#starting-and-stopping-containers)

Use the following commands to start or stop the development environment:

```
make start
make stop
```

If you are working with the staging or production environments, use their respective commands:

- Staging: `make start-staging` or `make stop-staging`.
- Production: `make start-prod` or `make stop-prod`.

Stopping and Removing Containers
--------------------------------

[](#stopping-and-removing-containers)

To completely stop and remove all environment containers and networks, use the following command:

```
make down
```

Note: Use environment-specific commands if you need to tear down the test, staging, or production environments. For a complete list of available commands, run `make help`.

Available Makefile Commands
---------------------------

[](#available-makefile-commands)

Here is a reference list of the primary commands available for managing the environment, databases, logs and testing:

```
make build
make build-test
make build-staging
make build-prod

make start
make start-test
make start-staging
make start-prod

make stop
make stop-test
make stop-staging
make stop-prod

make down
make down-test
make down-staging
make down-prod

make restart
make restart-test
make restart-staging
make restart-prod

make env-staging
make env-prod

make generate-jwt-keys

make ssh
make ssh-root
make fish
make ssh-nginx
make ssh-supervisord
make ssh-mysql
make ssh-rabbitmq
make ssh-elasticsearch
make ssh-kibana

make composer-install-no-dev
make composer-install
make composer-update
make composer-audit

make info
make help

make logs
make logs-nginx
make logs-supervisord
make logs-mysql
make logs-rabbitmq
make logs-elasticsearch
make logs-kibana
make logs-redis

make drop-migrate
make migrate
make migrate-no-test
make migrate-cron-jobs

make fixtures

make create-roles-groups

make messenger-setup-transports

make elastic-create-or-update-template

make phpunit
make report-code-coverage

make phpcs
make ecs
make ecs-fix
make phpmetrics
make phpcpd
make phpcpd-html-report
make phpmd
make phpstan
make phpinsights

# ... and many more
```

Note: For a complete list of all available commands, please inspect the `Makefile` directly or run `make help`.

Architecture &amp; packages
---------------------------

[](#architecture--packages)

**Core Framework &amp; Utilities**

- [Symfony](https://symfony.com)
- [messenger](https://symfony.com/doc/current/messenger.html)
- [api-doc-bundle](https://packagist.org/packages/nelmio/api-doc-bundle)
- [cors-bundle](https://packagist.org/packages/nelmio/cors-bundle)
- [command-scheduler-bundle](https://packagist.org/packages/dukecity/command-scheduler-bundle)
- [automapper-plus-bundle](https://packagist.org/packages/mark-gerarts/automapper-plus-bundle)
- [symfony-console-form](https://packagist.org/packages/matthiasnoback/symfony-console-form)
- [easy-log-bundle](https://packagist.org/packages/systemsdk/easy-log-bundle)
- [device-detector](https://packagist.org/packages/matomo/device-detector)

**Database &amp; Search**

- [doctrine-migrations-bundle](https://github.com/doctrine/DoctrineMigrationsBundle)
- [doctrine-fixtures-bundle](https://github.com/doctrine/DoctrineFixturesBundle)
- [uuid-doctrine](https://packagist.org/packages/ramsey/uuid-doctrine)
- [doctrine-extensions](https://packagist.org/packages/gedmo/doctrine-extensions)
- [beberlei/doctrineextensions](https://github.com/beberlei/DoctrineExtensions)
- [elasticsearch](https://github.com/elastic/elasticsearch-php)

**Authentication &amp; Security**

- [jwt-authentication-bundle](https://packagist.org/packages/lexik/jwt-authentication-bundle)
- [security-checker](https://github.com/fabpot/local-php-security-checker)
- [security-advisories](https://github.com/Roave/SecurityAdvisories)

**Testing, QA &amp; Static Analysis**

- [phpunit](https://github.com/sebastianbergmann/phpunit)
- [phpunit-bridge](https://github.com/symfony/phpunit-bridge)
- [dama/doctrine-test-bundle](https://packagist.org/packages/dama/doctrine-test-bundle)
- [browser-kit](https://github.com/symfony/browser-kit)
- [css-selector](https://github.com/symfony/css-selector)
- [php-coveralls](https://github.com/php-coveralls/php-coveralls)
- [phpstan](https://packagist.org/packages/phpstan/phpstan)
- [phpmd](https://packagist.org/packages/phpmd/phpmd)
- [phpcpd](https://packagist.org/packages/systemsdk/phpcpd)
- [PhpMetrics](https://github.com/phpmetrics/PhpMetrics)
- [phpinsights](https://packagist.org/packages/nunomaduro/phpinsights)
- [easy-coding-standard (ECS)](https://github.com/Symplify/EasyCodingStandard)
- [rector](https://packagist.org/packages/rector/rector)

**Composer &amp; Infrastructure Tools**

- [composer-bin-plugin](https://github.com/bamarni/composer-bin-plugin)
- [composer-normalize](https://github.com/ergebnis/composer-normalize)
- [composer-unused](https://packagist.org/packages/icanhazstring/composer-unused)
- [composer-require-checker](https://packagist.org/packages/maglnet/composer-require-checker)
- [requirements-checker](https://github.com/symfony/requirements-checker)

Guidelines
----------

[](#guidelines)

- [Commands](docs/commands.md)
- [Development](docs/development.md)
- [IDE PhpStorm Configuration](docs/phpstorm.md)
- [Xdebug Configuration](docs/xdebug.md)
- [Swagger](docs/swagger.md)
- [Postman](docs/postman.md)
- [Redis GUI](docs/rdm.md)
- [Messenger Component](docs/messenger.md)
- [Code Quality Tools](docs/code-quality.md)
- [Testing](docs/testing.md)
- [API Key](docs/api-key.md)

Development Workflow
--------------------

[](#development-workflow)

1. **Branching:** Create a new branch from `develop` using one of the following patterns:
    - `feature/{ticketNo}`
    - `bugfix/{ticketNo}`
2. **Commits:** Commit frequently and write clear, descriptive commit messages to facilitate the review process.
3. **Pull Request:** Push your branch to the repository and open a Pull Request (PR) against the `develop` branch. Use the following naming convention for your PR: `feature/{ticketNo} - Short descriptive title of the Jira task`.
4. **Review:** Address any feedback from reviewers and iterate as needed.
5. **CI/CD Checks:** Ensure that all continuous integration checks (e.g., CircleCI) pass successfully and the build status is green.
6. **Merge:** Once approved, your PR will be squashed and merged into `develop`. It will later be merged into a `release/{version}` branch for deployment.

Note: For a detailed visual guide on this branching model, please refer to the [Git Flow Cheatsheet](https://danielkummer.github.io/git-flow-cheatsheet).

License
-------

[](#license)

[The MIT License (MIT)](LICENSE)

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance96

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 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.

###  Release Activity

Cadence

Every ~33 days

Recently: every ~66 days

Total

50

Last Release

19d ago

Major Versions

v0.1.0 → v1.0.02022-05-01

v1.7.1 → v2.0.02024-02-14

v2.2.0 → v3.0.02024-06-25

v3.9.0 → v4.0.02026-03-30

PHP version history (5 changes)v0.1.0PHP ^8.1.0

v1.4.0PHP ^8.2.0

v2.0.0PHP ^8.3.0

v3.4.0PHP ^8.4.0

v4.0.0PHP ^8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/33e0fb1bc5cd58d4a1d671f46cd90d2d922ec5392f91b87ea346dcb82716b637?d=identicon)[dimadeush](/maintainers/dimadeush)

---

Top Contributors

[![dimadeush](https://avatars.githubusercontent.com/u/4595354?v=4)](https://github.com/dimadeush "dimadeush (3 commits)")

---

Tags

cicrondddddd-exampledockerelasticsearchkibanamulti-environmentmysqlmysql8nginxphpphp8rabbitmqrest-apisupervisordswaggersymfonysymfony7xdebugphpapisymfonyelasticsearchmysqlrabbitmqdockernginxsupervisord

### Embed Badge

![Health badge](/badges/systemsdk-docker-symfony-api/health.svg)

```
[![Health](https://phpackages.com/badges/systemsdk-docker-symfony-api/health.svg)](https://phpackages.com/packages/systemsdk-docker-symfony-api)
```

###  Alternatives

[sylius/sylius

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

8.5k6.0M778](/packages/sylius-sylius)[kimai/kimai

Kimai - Time Tracking

4.8k9.4k1](/packages/kimai-kimai)[chameleon-system/chameleon-base

The Chameleon System core.

1029.4k6](/packages/chameleon-system-chameleon-base)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M674](/packages/shopware-core)[pimcore/pimcore

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

3.8k3.9M535](/packages/pimcore-pimcore)[oro/platform

Business Application Platform (BAP)

645146.3k118](/packages/oro-platform)

PHPackages © 2026

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