Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi there,

I have a question about the auto-generated reference.php file that was introduced in recent Symfony versions (generated by PhpConfigReferenceDumpPass).

This file is automatically regenerated every time I run php bin/console cache:clear
It's generated in the config directory (which is typically versioned)
.

What's the goal of this file ?
Is this file intended to be committed to version control, or should it be gitignored?

You must be logged in to vote

This file provides array-shape type for the PHP configuration. It should be committed with your code and might change when you update the composer dependencies.

See: https://symfony.com/blog/new-in-symfony-7-4-better-php-configuration

These shapes are generated dynamically based on the bundles installed in your application. The generated file is called reference.php and is stored in the config/ directory. You should commit it to your repository and optionally add a new entry in the autoload section of composer.json (for example, "classmap": ["config/"]).

Replies: 4 comments · 7 replies

Comment options

This file provides array-shape type for the PHP configuration. It should be committed with your code and might change when you update the composer dependencies.

See: https://symfony.com/blog/new-in-symfony-7-4-better-php-configuration

These shapes are generated dynamically based on the bundles installed in your application. The generated file is called reference.php and is stored in the config/ directory. You should commit it to your repository and optionally add a new entry in the autoload section of composer.json (for example, "classmap": ["config/"]).

You must be logged in to vote
0 replies
Answer selected by floxblah
Comment options

Does this file work fine in a shared kernel multi app? Since we have 5 APP_ID's. We experience bootstrapping issues when switchings apps.

You must be logged in to vote
5 replies
@parijke
Comment options

We have currently solved it with this in our Kernel.php (thx @Ilyes512 ) but we are not sure if we experince problems in the future. The reference.php interferes the freshness check in shared kernel app

    #[Override]
    protected function getKernelParameters(): array
    {
        $parameters = $this->getKernelParametersTrait();

        $parameters['kernel.application_id'] = $this->getApplicationId()->value;
        $parameters['kernel.tenant_id'] = $this->getTenantId()->value;

        // Should only be used by PhpConfigReferenceDumpPass to generate the config reference for the app config dir
        // parameter.
        $parameters['.kernel.config_dir'] = $this->getBuildDir();

        return $parameters;
    }
    ```
@GromNaN
Comment options

GromNaN Feb 6, 2026
Collaborator

This file only depends on the bundles that are enabled in your dev environment.

@parijke
Comment options

Yes, which are different ones per apps, so the file constantly changes after swithcing apps, causing cache invalidation issues (in dev mode)

@Ilyes512
Comment options

The above snippet is not really a fix it's more of a workaround since the files now land in de build dir wish is inside the var dir assuming default config. Both my editor and the static code tool won't parse the file.

Being able to just turn this feature off would be even better.

This file only depends on the bundles that are enabled in your dev environment.

We are using a Shared Kernel setup where depending on an env var the loaded config, bundles etc are different. And so yes, that would mean a different reference file depending on the current shared kernel being loaded.

@okorneliuk
Comment options

With reference.php per app, we will have copied definitions for shared bundles in each reference.php file. IMO we should have the ability to configure shared reference.php for shared bundles and app-specific reference.php for app-specific bundles. However, at the moment of creation reference.php, we don't know which bundles are shared and which are app-specific, because in the shared kernel config, all bundles are merged into one flat array.

Comment options

Can it be generated only on composer update instead of cache clearing.
We jump back-and-forth between mutlitple older or newer branches to fix features. This file is commited in or another state, but is always re-generated is get's in the way of changed files. You must be carful not to commit this not intended change.
Very annoying

You must be logged in to vote
2 replies
@okorneliuk
Comment options

Totally agreed. When I use YAML config, I don't even need this file. Separate console command would be the most flexible idea.

@uncaught
Comment options

Do you know if there is an open issue for this? This is happening to us quite frequently, too. I can imagine the bigger the team this gets quite annoying.

Comment options

Just adding my vote for "this should be configurable and improved".
The initial blog post also raised a few concerns.
This file does not belong into the config/ directory and .gitignore is really not a long term solution.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
8 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.