Darkwood Blog Blog
  • Articles
  • Auto
  • Releases
en
  • de
  • fr
Login
  • Blog
  • Articles
  • Auto
  • Releases

πŸš€ From Zero to Hero with Sylius: Inside the Practical Essentials Workshop

on May 24, 2025

Log in to add a reaction to this post

If you're new to Sylius or looking to solidify your foundations, Gracjan JΓ³zefczyk, BitBag Developer & Sylius Key Contributor. It was a workshop at Sylius Days 2025 was a masterclass in eCommerce architecture. πŸ’‘

Mastering Sylius Fundamentals: From Resource Configuration to Grids

In a hands-on Sylius workshop led by key contributor and Sylius Academy creator Grazian, experienced Symfony developers explored the foundation of Sylius through live coding, architectural insights, and real-world implementation strategies. This post distills the core technical knowledge from the sessionβ€”focused on understanding Sylius' dual identity as a platform and a framework, the power of the ResourceBundle and GridBundle, and effective customization approaches.

Problem Context:

Sylius is a Symfony-based eCommerce solution that aims to be both developer-friendly and enterprise-ready. However, getting started or extending it (e.g., creating custom resources or interfaces) often feels daunting due to its opinionated architecture and dependency on its own bundles. Developers entering a Sylius project must first understand how the core entities, services, and configurations interplay to avoid friction later.

Solution Breakdown:

  • Understanding Sylius as a Framework and Platform

Sylius provides a bootstrap-based shop frontend, an admin panel, and a complete API out of the box. It combines the flexibility of a Symfony framework with the plug-and-play capabilities of an eCommerce platform.

Admin Panel: Uses Symfony Security firewalls to distinguish between admin and customer logins.

API: Built with API Platform. Endpoints are exposed for both shop and admin, with clear separation via /shop and /admin prefixes.

  • Resource Configuration with ResourceBundle

The SyliusResourceBundle abstracts away common CRUD operations by leveraging configuration-based entity declarations. To define a new resource:

sylius_resource:
    resources:
        app.brand:
            driver: doctrine/orm
            classes:
                model: App\Entity\Brand

This single block enables:

  • Controller instantiation (via ResourceController)
  • Factory, FormType, and Repository autowiring
  • Service autoconfiguration and routing

Bonus: Use debug:sylius:resource to inspect resource bindings.

  • Exposing Routes with Symfony Routing Config

Once declared, resource routes are exposed via:

sylius_admin_brand:
    resource: "sylius.resource"
    type: sylius.resource
    section: admin
    alias: app.brand
    templates: SyliusAdminBundle:Crud
    redirect: update
    grid: sylius_admin_brand
  • Data Listing with GridBundle

SyliusGridBundle enables admin-side grids for data visualization and interaction (filters, actions, bulk operations).

sylius_grid:
    grids:
        sylius_admin_brand:
            driver:
                name: doctrine/orm
                options:
                    class: App\Entity\Brand
            fields:
                name:
                    type: string
                    label: sylius.ui.name
            filters:
                name:
                    type: string

Grids integrate seamlessly with ResourceBundle. They support:

  • Column filters
  • Inline and bulk actions
  • Easy frontend rendering via Bootstrap-based templates

Extensibility and Community Practices

Advanced use cases showcased during the workshop:

  • Migrating from Sylius 1.14 to Sylius 2 (major changes in Grid rendering, ResourceBundle internals)
  • Using new PHP attribute-based resource declarations (#[AsResource]) to remove YAML verbosity
  • Replacing Winzou state machine with Symfony Workflow for order transitions
  • Integration strategies for CMS, PIM, or search backends (Elasticsearch)

A key strength of Sylius is its active community, maintaining open-source plugins (Stripe, Admin UI, etc.) and contributing back through GitHub and Slack support.

Result/Impact: Participants left with a production-ready Sylius setup, configured Docker environment, and practical knowledge to:

Extend Sylius with custom entities:

  • Use declarative configuration for rapid CRUD
  • Customize admin grids
  • Migrate to newer Sylius versions
  • This approach boosts maintainability, developer onboarding, and speeds up initial development cycles.

Key Takeaways:

  • SyliusResourceBundle eliminates boilerplate for CRUD.
  • SyliusGridBundle provides production-grade admin listings with minimal config.
  • Symfony integration is first-class, enabling smooth DX.
  • Community contributions and practices are critical for scaling Sylius.
  • Use YAML or PHP Attributes based on your project scale and team conventions.

πŸ”§ Mastering Sylius Customizations and Plugins β€” Advanced Developer Insights

During the advanced Sylius workshop, developers dived deep into two critical aspects of customizing enterprise-level e-commerce: tailoring the business logic via entity, form, and template overrides, and building modular, reusable plugins that remain maintainable and compatible across Sylius versions.

🧩 The Challenge

Modern e-commerce implementations often require tailored logic (e.g., product configurators, vendor-specific data, layered promotions). The default Sylius setup is flexible, but not always turn-key for these advanced needs.

Key developer goals include:

  • Extending entities without breaking inheritance or Doctrine mappings.
  • Injecting new fields into Symfony forms.
  • Overriding templates in a future-proof way.
  • Developing reusable plugins with test environments and version compatibility.

πŸ› οΈ Technical Implementation

Extending Entities and Forms

Example: Adding a brand relation to Product

// src/Entity/Product.php
class Product extends BaseProduct
{
    #[ORM\ManyToOne(targetEntity: Brand::class)]
    private ?Brand $brand = null;

    public function getBrand(): ?Brand { return $this->brand; }
    public function setBrand(?Brand $brand): void { $this->brand = $brand; }
}

Inject the field in the admin form using a Form Type Extension:

// src/Form/Extension/ProductTypeExtension.php
class ProductTypeExtension extends AbstractTypeExtension
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->add('brand', EntityType::class, [
            'class' => Brand::class,
            'choice_label' => 'name',
            'required' => false,
        ]);
    }

    public static function getExtendedTypes(): iterable
    {
        return [ProductType::class];
    }
}

Template Overrides with Twig Hooks

Instead of copying entire templates, you can inject custom logic using Twig Hooks, introduced in Sylius 1.11+.

{ % hook 'sylius.admin.product.form.tab' % }
    { { render(controller('App\\Controller\\BrandController::index')) } }
{ % endhook % }

You can inspect hook names and usage via the Symfony Profiler. Each hook accepts:

  • A priority (for order)
  • Parameters (passed to the template)
  • Optional pre/post hook zones

Building Robust Plugins

Plugin Skeleton

Sylius plugins follow a Symfony bundle structure:

src/
  MyPlugin/
    Controller/
    Entity/
    Repository/
    DependencyInjection/
    MyPlugin.php

They register configuration, routes, and services via dedicated manifests. Common use cases include:

  • Payment integrations (Stripe, Mollie, PayPal)
  • SEO features (sitemaps, structured data)
  • Import/Export functionality
  • Custom promotions, attributes, or checkout logic

Shared Test Application (New Approach)

Historically, each plugin had to ship with a full Sylius test app β€” creating maintenance nightmares across multiple versions.

Now, the community provides a shared test app package:

composer require --dev sylius/plugin-test-application

This allows per-version CI matrix testing with automatic config patching based on Sylius/Symfony versions.

sylius:
    version: ["1.11", "1.12", "1.13", "1.14", "2.0"]
    symfony: ["5.4", "6.4"]

No more Kernel.php hacks β€” this makes plugin dev faster and far more maintainable.

πŸ“ˆ Outcome and Benefits

  • Extensibility: Business-specific needs are encapsulated cleanly with zero coupling to Sylius core.
  • Testability: Plugins run isolated with full CI and test apps.
  • Compatibility: Supports multiple Sylius/Symfony versions easily.
  • Developer Experience (DX): Tools like Twig Hooks and sylius:make:resource speed up implementation dramatically.

βœ… Key Takeaways for Developers

βœ… Use Doctrine inheritance and FormTypeExtension to extend entities and forms cleanly.
βœ… Leverage Twig Hooks to inject UI logic without overriding full templates.
βœ… Structure your plugins like Symfony bundles and follow best practices (non-final repositories, isolated services).
βœ… Use the new test application tool to make your plugins compatible with multiple versions of Sylius and Symfony.
βœ… Extract reusable logic into plugins (payment, import/export, Elasticsearch, wishlists…) to scale across projects.

βœ… Why This Matters

This workshop wasn't just theoretical β€” it was built for action. If you're building scalable, customizable, and developer-friendly eCommerce solutions, mastering Sylius is a no-brainer. And Gracjan’s guidance made that journey 10x faster. ⚑

SyliusCon 2025

SyliusCon 2024 was a pivotal moment for the Sylius community, and the excitement is already building for SyliusCon 2025, promising even deeper insights, technical showcases, and community-driven innovation in the evolving e-commerce landscape.

Ressources

Sylius components

  • RessourceBundle : https://github.com/Sylius/SyliusResourceBundle
  • GridBundle : https://github.com/Sylius/SyliusGridBundle
  • Twig hooks : https://afup.org/talks/4929-creer-des-interfaces-d-administration-rapidement-avec-symfony-ux-et-sylius
  • SyliusRecipes : https://github.com/Sylius/SyliusRecipes
  • SyliusStandard : https://github.com/Sylius/Sylius-Standard
  • SyliusDemo : https://github.com/Sylius/SyliusDemo

Plugins

  • Stripe plugin : https://github.com/FLUX-SE/SyliusPayumStripePlugin
  • SyliusElasticsearchPlugin : https://github.com/BitBagCommerce/SyliusElasticsearchPlugin
  • SEO plugin
  • import export (Friend of Sylius) https://github.com/FriendsOfSylius/SyliusImportExportPlugin
  • whishlist
  • GDPR plugin (synolia)
  • Gift card
  • Invoices

πŸ’‘ Bonus for Creators & Builders

Want to automate your own processes like thumbnail creation, video publishing, or workflow management?

πŸ‘‰ I offer 30-minute free coaching sessions to help creators like you move faster. Let’s simplify your stack, together. πŸ“ž Book your free session here

Log in to add a reaction to this post

Site

  • Sitemap
  • Contact
  • Legal mentions

Network

  • Hello
  • Blog
  • Apps
  • Photos

Social

Darkwood 2026, all rights reserved