PLUGIN Mollie is now part of Sylius-Standard
3 min. read
Categories: Technical
Enhance Sylius Project Development with Codex

AI coding assistants have quietly become pretty impressive lately. What used to feel clunky now actually helps with real development work – understanding your code, suggesting improvements, and handling those repetitive tasks that eat up your day.

Codex stands out because it genuinely gets the context of what you’re building. Point it at your Sylius project, and it doesn’t just spit out generic PHP snippets. It understands e-commerce patterns, Symfony conventions, and the specific way Sylius handles everything from product variants to checkout flows.

Whether you’re new to Sylius or you’ve been wrestling with it for years, getting Codex properly configured can make a real difference. Instead of constantly switching between documentation tabs and Stack Overflow, you’ll have something that actually knows your codebase sitting right there in your editor.

Let’s walk through setting this up so Codex can start pulling its weight on your Sylius projects.

Why set up PHP support in Codex?

Providing Codex with a tailored Sylius environment allows it to go far beyond simple code generation. With the ability to run Composer, load dependencies, and understand the structure of your Sylius based project, Codex can now format your code, clean up inconsistencies, run static analysis tools, and even test the actual application logic – all within the container it controls.

This becomes handy in projects where much of the development revolves around conventions, configuration, and extensibility. Once PHP is available, Codex can help scaffold models, extend grids, decorate services, generate API resources, or adjust Doctrine mappings – while respecting Sylius architecture and patterns.

Add PHP Support via Environment Setup Script

To enable PHP support for your Sylius project in Codex:

  1. Open your Codex workspace.
  2. Go to the Environments tab.
  3. Select the environment you’re using (or create a new one).
  4. Click Edit, and locate the Setup Script section.
  5. Paste the following script:
#!/usr/bin/env bash

set -euo pipefail

export DEBIAN_FRONTEND=noninteractive

PHP_VERSION=${PHP_VERSION:-8.3}

apt-get update  && apt-get install -y --no-install-recommends       software-properties-common       ca-certificates       gnupg2       lsb-release       curl  && add-apt-repository -y ppa:ondrej/php  && apt-get update  && apt-get install -y --no-install-recommends       php${PHP_VERSION}       php${PHP_VERSION}-cli       php${PHP_VERSION}-fpm       php${PHP_VERSION}-mbstring       php${PHP_VERSION}-xml       php${PHP_VERSION}-intl       php${PHP_VERSION}-gd       php${PHP_VERSION}-zip       php${PHP_VERSION}-curl       php${PHP_VERSION}-iconv       php${PHP_VERSION}-ctype       php${PHP_VERSION}-yaml       php${PHP_VERSION}-pdo       php${PHP_VERSION}-pdo-mysql       php${PHP_VERSION}-pdo-sqlite  && rm -rf /var/lib/apt/lists/*

update-alternatives --install /usr/bin/php php /usr/bin/php${PHP_VERSION} 83  && update-alternatives --set php /usr/bin/php${PHP_VERSION}

EXPECTED_SIG="$(curl -fsSL https://composer.github.io/installer.sig)"

cu​rl -fsSL https://getcomposer.org/installer -o composer-setup.php

ACTUAL_SIG="$(sha384sum composer-setup.php | awk '{print $1}')"

if [ "$EXPECTED_SIG" != "$ACTUAL_SIG" ]; then

  echo "ERROR: Invalid Composer installer checksum." >&2

  rm composer-setup.php

  exit 1

fi

php composer-setup.php --install-dir=/usr/local/bin --filename=composer --quiet

rm composer-setup.php

composer install --no-interaction

php -v

composer --version
  1. Save the environment.

This way, each time Codex spins up your environment, it will have PHP, Composer, and all the Sylius-required extensions ready to go, allowing Codex to analyze, modify, and interact with your project as expected.

Helping Codex Understand Your Sylius Architecture – agents.md

To make Codex (or any AI-powered assistant) our effective ally, it needs more than just code – it needs context. This is exactly what the agents.md file provides: a lightweight configuration document that describes how your application is structured, how it works, and what conventions it follows.

Here you can check an official example from the Sylius team:
👉 AGENTS.md in Sylius 2.1

This setup is specifically for framework development, so if you’re diving into Sylius core, contributing patches, or working on the framework itself. If you’re building an actual e-commerce store with Sylius or developing plugins for it, you’ll want to adjust the contents and perspective to reflect your project’s specifics.

What should agents.md include?

  • Indication that the project is based on Sylius and Symfony
  • Where to find key directories: src/, config/, tests/, features/
  • How to run tools like: vendor/bin/phpstan
  • What conventions are used for plugins, decorators, resources, admin extensions, etc.

This provides Codex with the necessary information to generate accurate and idiomatic code for your Sylius architecture.

Bonus: It works beyond Codex

The agents.md file can also improve suggestions and context understanding in other tools like Claude or GitHub Copilot – it’s a simple, reusable way to help any AI better understand your codebase.

Let’s see the Codex and Sylius in practice

When properly set up, Codex improves Sylius workflows in many ways:

For beginners

  • Customize API resources, form types, services, and CLI commands
  • Understand common Sylius customization patterns
  • Generate tests or analyze errors with actionable feedback

For advanced users

  • Refactor pricing logic or checkout steps to match specific business use cases
  • Decorate existing models or repositories with custom behavior
  • Extend admin grids or override templates using AI-assisted changes

For teams

  • Reduce onboarding time for new developers
  • Automate repetitive changes across multiple modules or plugins
  • Generate realistic, business-specific fixtures for development and testing
  • Maintain consistency and code quality with AI-guided suggestions

Wrapping up

With a bit of setup, Codex turns from just another coding assistant into something that actually gets your Sylius project. Set up a proper PHP environment and drop in a well-written agents.md file, and suddenly it’s not just suggesting random code but understands your patterns, your conventions, and the way things should actually work.

This works whether you’re contributing to the Sylius core development or building out a custom store. Codex handles those repetitive tasks that slow you down, while keeping everything consistent with Sylius’ best practices. It’s like having a teammate who never gets tired of writing boilerplate and actually remembers how you like things done.

Tags: Sylius
Share:
Michał Pysiak
More from our blog
Technical 3 min read 04.12.2024
Here’s everything you had to know about the first major release since 2017! Over 7 years after the first major release, on Nov 12, 2024, we have released Sylius 2.0.0. We had a great opportunity to announce it first at SyliusCon in Lyon, but now, as we are back to… Read More
3 min read 22.11.2024
The emotions start to settle after SyliusCon, and it’s time to reflect on this incredible milestone in our journey. Why a milestone? Because SyliusCon exceeded our expectations in every possible way. We broke attendance records and brought together the key figures of our community, numerous partners, freelancers, and simply all… Read More
Cloud 3 min read 17.06.2024
We are thrilled to announce that we just signed a strategic partnership with Platform.sh, and as a result, we are extending our offer with Sylius Cloud powered by Platform.sh. Platform.sh is a modern Platform-as-a-Service (PaaS) solution that allows businesses to leverage the cloud environment without losing access to the code… Read More
Comments