Skip to content

[RFC] Use PHP format in config files on project creation #60886

Open
@damienfern

Description

@damienfern

Description

By default, Symfony loads the configuration files defined in YAML and PHP formats. When creating a new Symfony project, Symfony Flex uses the YAML config files provided in the recipes.

IMO, PHP config files are more convenient than YAML config for the following reasons:

  • Better integration in our IDE without any additional plugin
  • Deprecations are warned early
  • No need to run the code to see errors types in our config files
  • Allows you to create dynamic configuration with arrays or config builder
  • Our favorite CI tools can watch config files too

The main "drawback" is that config classes are generated in cache when running cache:clear and those files need to be included in your IDE index.

I think we should encourage devs to use PHP format for config files, and it can start by providing config files in PHP format.

What are your thoughts about this ? Do you write your config files with PHP files ? Why ? Why not ?

I'm opening discussions to get feedback about the use of PHP in config and see if it's relevant or not.

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions