Configuration and environments
Configuration has two levels. Bundle config (config/packages/*.yaml) describes how the framework is set up and is read when the container is compiled. Environment variables (%env(...)%) hold what differs between servers and are read at runtime.
Magento · a value from the admin
$enabled = $this->scopeConfig->isSetFlag(
'faq/general/enabled',
ScopeInterface::SCOPE_STORE
);
Symfony · a value from the environment
# .env
FAQ_ENABLED=1
final class FaqMenu
{
public function __construct(
#[Autowire(env: 'bool:FAQ_ENABLED')]
private bool $enabled,
) {}
}
- File order:
.env→.env.local→.env.$APP_ENV→.env.$APP_ENV.local. Real environment variables win over all files..envis committed,*.localis not. - Processors:
%env(int:X)%,bool:,json:,resolve:,default:fallback_param:X. - Secrets:
bin/console secrets:set ERP_TOKENencrypts the value in the repository, the decryption key lives only on the server. - Environments: a
when@prod:block in any YAML or the#[When(env: 'dev')]attribute on a class. - Prod:
composer dump-env prodbuilds.env.local.phpso the files aren't parsed on every request. - Reference:
debug:config frameworkshows the actual values,config:dump-reference doctrineshows all possible options.
There are no admin settings
If the business needs settings that a person changes in the browser, that is an ordinary entity, table, form and cache that you write yourself. There are no store/website scopes either: a multi-store or multi-tenant setup is designed separately.