Search by

agence-adeliom / sylius-easy-crud-plugin

jeromeengelnadeliom

Easy CRUD plugin for Sylius.

Package info

github.com/agence-adeliom/sylius-easy-crud-plugin

Type:sylius-plugin

pkg:composer/agence-adeliom/sylius-easy-crud-plugin

Statistics

Installs: 6 141

Dependents: 1

Suggesters: 0

Stars: 3

Open Issues: 2

v2.3.3 2026-10-23 14:25 UTC

README

Sylius Easy CRUD Plugin

Easy crud banner

Overview • Installation • Quick Start • Documentation

Overview

Sylius Easy CRUD Plugin is an abstraction layer that helps building CRUD interfaces in Sylius e-commerce.

🧩 Define your entire CRUD interface (list, create, edit, show, delete) in a single configureFields() method on a App\Admin\ResourceAdmin class based on Sylius resources — similar to EasyAdminBundle, but integrated with Sylius!

🚀 With this Admin class this plugin generates automatically all CRUD interfaces for you: Grid, Creation/Edition forms, Show page, and preconfigured CRUD Actions. It also provides a rich set of form field types that helps you build forms with minimal code.

✨ Transform Symfony entities / Sylius resources into fully functional admin interfaces in minutes!

Post CRUD example

#[AsAdmin(resourceClass: Post::class)]
final class PostAdmin extends AbstractAdmin
{
    /**
     * @return iterable<FieldInterface>
     */
    public function configureFields(string $pageName, ?string $context = null): iterable
    {

        yield TabField::new('tab1', 'Tab 1');
    
        yield ColumnField::new('tab1_left')
            ->setSize(ColumnSizeEnum::WIDE_8_OF_12);
    
        yield TranslationField::new('translations')
            ->addField(
                Field::new('name')
                ->setDisabled(false)
                ->setRequired(true)
            )
            ->onlyOnForms();
    
        yield ColumnField::new('tab1_right')
            ->setSize(ColumnSizeEnum::WIDE_4_OF_12);
    
        yield IconField::new('icon')
            ->onlyOnForms();
    
        yield CheckboxField::new('enabled');
    
        ...
    
    }
    
    /**
     * @return iterable<FilterInterface>
     */
    public function configureFilters(): iterable
    {
        yield BooleanFilter::create('enabled')
            ->setLabel('Enabled');
    }
    
    public function configureActions(string $pageName): Actions
    {
        return parent::configureActions($pageName)
            ->remove(Crud::PAGE_EDIT, Action::DELETE);
    }
}

What Makes It Easy?

  • 🚀 Rapid Development: Generate complete CRUD interfaces in minutes with Symfony Maker commands
  • 🎨 Rich Field Types: 18+ specialized fields (Image, WYSIWYG, CodeEditor, Slug, Sortable Collections, and more)
  • 🌍 i18n Ready: Built-in translatable content mapped to Sylius Translation system
  • 🧩 Highly Extensible: Custom field configurators, actions, and form types
  • 😎 Centralized configuration: CRUD configuration in a single Admin class per resource

Why we built this plugin

In our previous Symfony projects we were familiar with EasyAdminBundle and developed several bundles based on it. When we migrated to Sylius, we looked for a fast and efficient way to reuse those bundles, so we tried to integrate the missing parts:

  • The EasyAdmin abstraction layer to allow building forms, lists and show pages in a single Admin class.
  • Our previous CMS features.

We have used this bundle in production on several projects and decided to share it with the community.

It does not fully comply (yet) with last Sylius guidelines, so please use this plugin with caution.

A duo: Easy CRUD + Happy CMS

Alongside this plugin, we migrated our other EasyAdmin-based bundles — which provided content management (CMS) features — into a separate plugin called Happy CMS. It is an alternative for building CMS features in Sylius.

Versions

Plugin Version Sylius Php Symfony
1.13, 1.14 1.13, 1.14 8.2, 8.3, 8.4 6.4, 7.x
^2.0.0 ^2.0.0 8.2, 8.3, 8.4 6.4, 7.x
^2.1.0 ^2.1.0, ^2.2.0 8.3, 8.4, 8.5 6.4, 7.x
^2.3.0 ^2.3.0 8.4, 8.5 7.4, 8.x

Upgrading? Read UPGRADE.md: 2.3.2 declares the resources with attributes (the YAML declaration is deprecated) and contains backward compatibility breaks for Admins overriding the constructor and custom controllers.

Installation

1. Install via Composer

composer require agence-adeliom/sylius-easy-crud-plugin
composer require --dev symfony/maker-bundle

2. Enable the Bundle

Add the plugin to config/bundles.php:

<?php

return [
    // ...
    Adeliom\SyliusEasyCrudPlugin\SyliusEasyCrudPlugin::class => ['all' => true],
   
    Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true, 'test' => true],
];

3. Import Configuration

In config/packages/_sylius.yaml:

imports:
    - { resource: "@SyliusEasyCrudPlugin/config/config.yaml" }

4. Import Routes

In config/routes.yaml:

sylius_easy_crud:
    resource: "@SyliusEasyCrudPlugin/config/routes.yaml"

The plugin routes, and the routes of the resources declared with #[AsAdmin], are then served under the Sylius admin path (/%sylius_admin.path_name%, /admin by default). If your admin uses another prefix or its own host, import the unprefixed admin routes and the #[AsAdmin] routes loader instead:

sylius_easy_crud_admin:
    resource: "@SyliusEasyCrudPlugin/config/routes/admin.yaml"
    prefix: /back-office        # or no prefix at all
    host: '%admin_host%'        # optional

sylius_easy_crud_attributes:
    resource: 'Adeliom\SyliusEasyCrudPlugin\Routing\EasyCrudAttributesRoutesLoader'
    type: service
    prefix: /back-office
    host: '%admin_host%'

5. Declare the resources with attributes

Enable the discovery of the #[AsAdmin] Admin classes, and the native Sylius discovery of the #[AsResource] models:

# config/packages/sylius_easy_crud.yaml
sylius_easy_crud:
    attributes:
        enabled: true                              # a boolean or a %parameter%, not an environment variable
        paths: ['%kernel.project_dir%/src/Admin']  # existing directories holding the #[AsAdmin] classes

# config/packages/sylius_resource.yaml
sylius_resource:
    mapping:
        paths: ['%kernel.project_dir%/src/Entity'] # where the #[AsResource] models live

Without it (enabled: false, the default), the resources are declared with the sylius_resource + type: sylius.resource YAML blocks, which is deprecated: see UPGRADE.md to migrate.

6. Install Assets

php bin/console assets:install

Quick Start

Step 1: Generate an Entity

Create a new entity with translation support:

php bin/console make:easy-crud:create-entity Post
php bin/console doc:mig:diff
php bin/console doc:mig:mig

This generates:

  • src/Entity/Post.php
  • src/Entity/PostTranslation.php
  • src/Repository/PostRepository.php

Step 2: Generate the CRUD

Create a complete CRUD interface for your entity:

php bin/console make:easy-crud:create-crud Post

This generates:

  • src/Admin/PostAdmin.php - CRUD configuration class, with #[AsAdmin]
  • Updates src/Entity/Post.php - Adds #[AsResource]
  • Updates src/Menu/AdminMenuListener.php - Adds menu entry

With sylius_easy_crud.attributes.enabled: false, it updates config/routes.yaml and config/packages/sylius_resource.yaml instead of adding the attributes (deprecated).

Step 3: Configure Your CRUD

Edit src/Admin/PostAdmin.php: Configure your fields in the configureFields() or your filters with configureFilters() method.

Discover available fields

Step 4: Access Your CRUD

Navigate to your Sylius admin panel and find your new "Posts" menu entry. You now have a fully functional CRUD interface!

Documentation

📚 User Guides

If this plugin helped you, please consider giving it a ⭐ on GitHub!

Made with ❤️ by Adeliom

License PHP Version Sylius Version Latest Version