Ease the declaration of routing and services for Symfony 3 & 4

Installs: 37 206

Dependents: 14

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 5

Open Issues: 3


v1.1.4 2021-11-25 16:10 UTC


Sidus/BaseBundle Documentation

Service loading

If you simply inherit from the SidusBaseExtension, all the YAML files present in this directory will be loaded: ./Resources/config/services


namespace FooBarBundle\DependencyInjection;

use Sidus\BaseBundle\DependencyInjection\SidusBaseExtension;

class FooBarExtension extends SidusBaseExtension


Instead of using controllers, declare service for each action and then you just have to declare the routing like this:

FooBarBundle\Action\MyAction: # Route name must match service id
    path: /path/{parameter}

You don't need to declare the _controller part, it will be loaded with your route name.

Param converter

Take a look at the AbstractParamConverter, declaring param converter is much more simple now

Compiler passes

The GenericCompilerPass allows you to easily inject all services tagged with a specific tag into another service.


DateTime parsing

DateTimeUtility::parse will allow you to parse date time from multiple formats easily.


Use the TranslatorUtility to iterate over various translation keys in order to return the first matching one.


You can use the BaseLoader class to load a sets of constraints from a PHP array with the same syntax than Yaml:

/** @var ValidatorInterface $validator */

use Sidus\BaseBundle\Validator\Mapping\Loader\BaseLoader;use Symfony\Component\Validator\Validator\ValidatorInterface;

$loader = new BaseLoader();

$constraints = $loader->loadCustomConstraints([
    ['Regex' => ['pattern' => '/^[a-z0-9]+(?:[-\_][a-z0-9]+)*$/']],
    ['NotNull' => null],

foreach ($constraints as $constraint) {
    $violations = $validator->validate($data, $constraint);
    // Do stuff with the violations


The ChoiceTypeExtension allows choice form types to work with iterable objects. You don't need to do anything.

A new option is available for any form type: block_prefix allows you to directly choose a custom block prefix for form rendering.


See SidusBaseSerializerBundle for additional support.