Symfony Bundles in Spryker

Edit on GitHub
On your own risk

This feature is experimental, and we do not recommend using it on production.

This document describes how to use Symfony Bundles in your Spryker project.

Registering a bundle

To use a bundle, you need to register it in config/{APPLICATION}/bundles.php. For example in config/Zed/bundles.php

For example, to use the FrameworkBundle, which is required to use the Dependency Injection component, add the following to your config/Zed/bundles.php file:

<?php

use Symfony\Bundle\FrameworkBundle\FrameworkBundle;

return [
    FrameworkBundle::class => ['all' => true],
];

Configuring bundles and services

You can configure bundles in the same way as provided by Symfony by adding config/Zed/packages/*.php files to the config/ folder. For more information, see Configuring Bundles.

Example of the FrameworkBundle in config/Zed/packages/framework.php:

<?php

declare(strict_types = 1);

use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework): void {
    $framework->secret('spryker-zed-secret');

    $framework->assets([
            'base_path' => '/assets',
        ]);

    $framework->test('%kernel.environment%' === 'dockerdev');
};

Next steps