Symfony Bundles in Spryker
Edit on GitHubThis 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],
];
SecurityBundle
The Symfony SecurityBundle provides authentication and authorization for Spryker’s API Platform integration. It enables Bearer token (JWT) authentication and security expressions on API resources.
To register the SecurityBundle for a Glue application, add it to config/{APPLICATION}/bundles.php:
<?php
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
return [
FrameworkBundle::class => ['all' => true],
SecurityBundle::class => ['all' => true],
// ... other bundles
];
For the complete setup including firewall configuration and security expressions, see How to integrate API Platform Security.
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
Thank you!
For submitting the form