Skip to main content

Using DDEV for Sylius Plugin Development

· 2 min read
Stephan Hochdörfer
Head of IT Business Operations

For about 1 year, we've been using DDEV for most of our Docker setups. While Sylius comes with its own Docker setup, I wanted to see if I could use DDEV to develop Sylius plugins as this would offer me a similar Docker experience to our other projects.

Thankfully, DDEV allows quite flexible setups, so getting it to run as I needed it was simple. As a prerequisite, you need 2 project directories, one for the Sylius application and one for the Sylius plugin you want to develop. In my case, the directory structure looks like this:

  • ./Workspace/ForceLogin/sylius (the Sylius application is located in this directory)
  • ./Workspace/ForceLogin/sylius-force-login-plugin (The Sylius plugin is located here)

How can we "link" both projects and make Sylius aware of the plugin? By using a custom Composer repository.

The plan is to mount the plugin directory into the DDEV/Docker environment and then use the mounted directory as a source for a custom Composer repository.

The following steps outline how to achieve that. It is assumed you have a configured DDEV environment up and running in the ./Workspace/ForceLogin/sylius project directory.

  1. Mount the plugin directory in the DDEV/Docker environment by creating a file .ddev/docker-compose.mounts.yaml with the following content in the ./Workspace/ForceLogin/sylius project directory:
- "./../../sylius-force-login-plugin:/sylius-force-login-plugin"

After restarting ddev with ddev restart, the new mount point is active in the web container.

  1. Define a custom Composer repository in your ./Workspace/ForceLogin/sylius/composer.json file, by adding the following repositories section:
"repositories": [
"type": "path",
"url": "/sylius-force-login-plugin/"
  1. Now we can use Composer to install the plugin in the project directory by running Composer via DDEV:
ddev composer require bitexpert/sylius-force-login-plugin:dev-master

Once the Composer installation is done, proceed to install the Sylius plugin as needed, and everything should work fine in your project directory.

Additionally, in PhpStorm, I have both projects attached in one project view which allows me to seamlessly switch between both projects.