Skip to content

[RFC][DX] Add possibility to provide bundle configuration (definition) inside the bundle class #40259

Closed
@mahono

Description

@mahono

Description
With all the recent changes towrds configuring things using PHP I wonder why not providing the possibility to provide bundle configuration directly inside the bundle class. Currently developers need to create an extension class and then a Resources/services.php file to return the configuration definition.

I think it could be a great improvement to provide an empty method in Symfony\Component\HttpKernel\Bundle\Bundle that can be overridden to just return that same configuration you would return in the Resources/services.php file.

Example
From developer perspective it could look like this in a bundle class:

class ByAwesomeBundle extends Bundle
{
    protected function configureContainer(ContainerConfigurator $container)
    {
        // Do whatever you like to configure the container for the bundle.
    }
}

Or I'm not 100% sure how the system works maybe the method needs to return Closure to work with the container building system.

I just wanted to report this idea. :o)

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)RFCRFC = Request For Comments (proposals about features that you want to be discussed)Status: Waiting feedback

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions