Use the ECL Twig in your Symfony applications.

Installs: 38

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0


0.1.6 2019-11-28 21:54 UTC

This package is auto-updated.

Last update: 2023-04-29 01:15:32 UTC


Use the ECL Twig framework in your Symfony applications.

This bundle will download the ECL Twig framework and do the necessary to provide a way to use its components within your application.

It will also provides Twig namespaces automatically.


  • PHP >= 7.1.3


This package does not provide the CSS and the JS files (yet?), feel free to use the CDN version in the meantime (README).


composer require drupol/ecl-twig-bundle

Then and optionally, you can create a file config/packages/ecl_twig.yaml containing:

    namespace: ec

To specify which preset will be the default one. By default, that value is set to ec even if the configuration file does not exists.

We will provide very soon a Symfony Flex recipe so the manual creation of this file will not be necessary anymore.


Here's a basic example of a simple Symfony controller:



namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class Ecl extends AbstractController
     * @Route("/ecl")
    public function ecl()
        return $this->render(
                'text' => 'foo',
                'disabled' => 'false',
                'icon' => [
                    'name' => 'plop',

To check what are the namespaces and the paths that this bundle adds, use the console command:

./bin/console debug:twig

An ECL component can be referenced using multiple notations.

Let's say you want to display the button component.

As there might be multiple flavor (or presets) of ECL, the button component will be in a directory that follows the following pattern:


Then, if you want to you can use one of the following notation:

  • @ecl-twig/ec-component-button/ecl-button.html.twig

Those names will reference the same file in the ECL Twig sources.

If you use the last notation ecl-button.html.twig, then the preset ec will be the default. Create a config file to override the parameter in config/packages/ecl_twig.yaml:

    namespace: ec

Then, loading the component:

  • @ecl-twig/ec-component-button/ecl-button.html.twig
  • ec-component-button/ecl-button.html.twig
  • ecl-button.html.twig

Will respectively load:

  • vendor/ec-europa/ecl-twig/src/ec/packages/ec-component-button/ecl-button.html.twig
  • vendor/ec-europa/ecl-twig/src/ec/packages/ec-component-button/ecl-button.html.twig
  • vendor/ec-europa/ecl-twig/src/ec/packages/ec-component-button/ecl-button.html.twig