Title: Symfony4 right way to handle parameter configuration settings
Tags: symfony
Question: I work in a company with multiples Symfony apps.
We have a vendor 'CommonBundle'.
This bundle needs to define some configuration for all apps specific by app
example: project_name_prefix / regex_format_for_title
My question is:
How should I serve this configuration for my projects?
Put a value in parameters: section in the services.yml and list all needed values
If a new parameter is added, how to tell to all apps to fill this new parameter ?
Put a ConfigurationExtension in my bundle and define my tree
Then create a config/packages/common_domain.yml file and add my config ?
Create the ConfigurationExtension and then map the values to parameters with '%project_name%'
In my code, with parameters I can use $this-&gt;container-&gt;getParameter('...') but with the ConfigurationExtension in DI, how can I retrieve the values?
UPDATE
The aim of my question is to know when use a parameter value and when configuring a tree.
For example the doctrine charset is like:
doctrine:
dbal:
charset: utf8
Is it a reason to not just use a parameter like
parameters:
doctrine_dbal_charset: utf8
And then  $this-&gt;container-&gt;getParameter('doctrine_dbal_charset')
Comment: Your second option is the right approach.  Use a common.yml file in conjunction with an extension to process the configuration.  Study up on [creating extensions](https://symfony.com/doc/4.1/bundles/configuration.html) to see how to expose the config data to the rest of your code.  And while a bit off topic, in Symfony 4 there should be very few cases in which $container->getParameter or get() will need to be used.

Comment: Looks like you tweaked your question quite a bit.  To address your specific example of doctrine_dbal_charset, you should be aware that doctrine allows you to configure multiple connections each potentially supporting different character sets.  Try figuring out how to do that with just parameters.  In fact take a look at what the DoctrineBundle extension does and try to figure out how to reduce to a set of parameters.  Ideally with default values and error checking.

Comment: This might help you: https://www.tomasvotruba.cz/blog/2018/11/29/how-to-manage-configuration-in-symfony-without-bundle-extension-and-configuraiton/


Here is another answer: This question have detailed answer into official Symfony documentation.
Officially proposed way is to use either environment variables or .env files and reference these variables in parameters as %env(VARIABLE_NAME)%
Comment for this answer: @Lerminou nothing stops you from passing any information through environment variables
Comment for this answer: @Lerminou I see, your question is more for advice then technical aspect. I would agree with Cerad that building configuration for your bundle will be the most flexible approach and it will allow you to provide sensible defaults for applications that did not immediately recognize new configuration parameters. It also provides good facilities for data validation / normalization.
Comment for this answer: AFAIK, .env variable is for sentitive value right ? like the database_url, but in my case, it's only a project_name. I updated my question to be more precise ,
Comment for this answer: yes I agree with you, but please read my update, my question is : where should I fill the env var ? for example the doctrine database_url is set in a treeBuilder in the doctrine config file `doctrine:dbal:url:` Why don't they just use a parameter key ?

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 3, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2019:00:01/31/19', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<symfony>', 'Title': 'Symfony4 right way to handle parameter configuration settings', 'ViewCount': 64, 'id': 54458955, 'user_AboutMe': "<p>I have so many things to speak about...\nSorry guys, I can't tell you all of this.</p>\n", 'user_AccountId': 5933664.0, 'user_DisplayName': 'Lerminou', 'user_Reputation': 170.0, 'user_Views': 31.0, 'user_id': 4667411.0}}