Answer the question
In order to leave comments, you need to log in
How to add php config?
How to add php config in symfony 5?
Let's say I created a data subfolder in the config folder and there the test.php file
. I want to get this data in the controller in a similar way (as in Laravel).
The documentation saysconfig('data.test')
By default Symfony only loads the configuration files defined in YAML format. If you define configuration in XML and/or PHP formats, update the src/Kernel.php file to add support for the .xml and .php file extensions.but they didn’t give a link how to do it ... I did it, it didn’t help. Data access, as I understand it, will be in the controller .
$container->import('../config/data/*.php', 'php')
$this->getParameter('data.test')
Answer the question
In order to leave comments, you need to log in
https://symfony.com/doc/current/configuration.html...
https://symfony.com/doc/current/configuration.html...
https://symfony.com/doc/current/configuration. html...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question