Fast Sylius Plugins Contribution Setup

If you want to start contributing to a Sylius plugin and don’t want to waste time on manual setup, DDEV is a great tool that helps you configure a working environment in just a few minutes.

In this post, I’ll show you how to do it using SyliusTpayPlugin as an example. This project is a perfect fit — not only because of its technical specifics, but also because it’s active, you can get valuable code reviews, and it’s a great starting point for your Open Source contributions.

Before starting, make sure you have Docker and DDEV installed on your machine, as this setup is based on Docker containers.

1. Clone the repository

First, grab the plugin code from GitHub and move into the project folder. Check the repository wiki for instructions on preparing the project for contribution:

git clone https://github.com/CommerceWeavers/SyliusTpayPlugin.git
cd SyliusTpayPlugin

2. Configure DDEV

Next, configure DDEV for the project. You can use flags with ddev config for a quick setup, or run the interactive wizard, which guides you step by step.

ddev config --project-type=symfony --docroot=tests/Application/public --create-docroot

Open .ddev/config.yaml to fine-tune settings such as:

  • PHP version,
  • database type and version,
  • web server (nginx or Apache),
  • ports for the app and services.

After configuring, start the environment:

ddev start

3. Configure environment variables

Next, set up the environment variables required by the project. In the .env or .env.local file, add at least the following entry for the database:

DATABASE_URL=mysql://db:db@db/cw_sylius_tpay_plugin_%kernel.environment%?serverVersion=5.7

You can also add other project-specific variables, such as Payum keys or Tpay credentials, if needed.

To check your DDEV configuration and confirm that everything is set up correctly, run:

ddev describe

4. Install Mockoon CLI globally with Yarn

To simulate Tpay API locally, install mockoon-cli globally inside the container using Yarn:

ddev ssh
yarn global add @mockoon/cli

You can then start a local mock server directly from the container:

mockoon-cli start --data tests/mockoon_tpay.json --port 4000

5. Install WebDrivers for testing

If you need to run browser tests (e.g., with Behat or Panther), you can install WebDrivers using the DDEV Selenium Standalone Chrome add-on:

ddev get ddev/ddev-selenium-standalone-chrome
ddev restart

Tests\CommerceWeavers\SyliusTpayPlugin\E2E\E2ETestCase.php:

$this->client = self::createPantherClient(
    options: [
        'browser' => PantherTestCase::SELENIUM,
    ],
    managerOptions: [
        'host' => 'https://web:443',
        'capabilities' => DesiredCapabilities::chrome(),
    ],
);

With your environment fully set up, you can now follow the instructions in the wiki to start contributing to the plugin.

Benefits and Useful Integrations

Using DDEV gives you several built-in tools and integrations that make development faster and easier:

Xdebug

Enable step debugging in your IDE to inspect code and trace errors:

ddev xdebug on

Ngrok

Share your local environment with a public HTTPS URL, perfect for testing webhooks:

ddev share

Database access with phpMyAdmin (or other clients)

ddev mysql

ddev phpmyadmin
ddev tableplus
ddev sequelpro

ddev snapshot

Mailpit (Email Gateway)

Capture outgoing emails from your application without sending them to real users. Access it in your browser at:

ddev mailpit

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *