@@ -485,48 +485,45 @@ You can reference environment variables using the special syntax
485
485
``%env(ENV_VAR_NAME)% ``. The values of these options are resolved at runtime
486
486
(only once per request, to not impact performance).
487
487
488
- This example shows how you could configure the database connection using an env var:
488
+ This example shows how you could configure the application secret using an env var:
489
489
490
490
.. configuration-block ::
491
491
492
492
.. code-block :: yaml
493
493
494
- # config/packages/doctrine .yaml
495
- doctrine :
496
- dbal :
494
+ # config/packages/framework .yaml
495
+ framework :
496
+ secret : ' %env(string:SECRET)% '
497
497
# by convention the env var names are always uppercase
498
- url : ' %env(DATABASE_URL )%'
498
+ secret : ' %env(APP_SECRET )%'
499
499
# ...
500
500
501
501
.. code-block :: xml
502
502
503
- <!-- config/packages/doctrine .xml -->
503
+ <!-- config/packages/framework .xml -->
504
504
<?xml version =" 1.0" encoding =" UTF-8" ?>
505
505
<container xmlns =" http://symfony.com/schema/dic/services"
506
506
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
507
- xmlns : doctrine =" http://symfony.com/schema/dic/doctrine"
508
507
xsi : schemaLocation =" http://symfony.com/schema/dic/services
509
- https://symfony.com/schema/dic/services/services-1.0.xsd
510
- http://symfony.com/schema/dic/doctrine
511
- https://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd" >
508
+ https://symfony.com/schema/dic/services/services-1.0.xsd>
512
509
513
- <doctrine : config >
510
+ <framework :config>
514
511
<!-- by convention the env var names are always uppercase -->
515
- <doctrine : dbal url =" %env(resolve:DATABASE_URL )%" />
516
- </doctrine : config >
512
+ <framework:secret url=" %env(string:SECRET )%" />
513
+ </framework :config>
517
514
518
515
</container>
519
516
520
517
.. code-block:: php
521
518
522
- // config/packages/doctrine .php
519
+ // config/packages/framework .php
523
520
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
524
521
525
522
return static function (ContainerConfigurator $container) {
526
- $container->extension('doctrine ', [
527
- 'dbal ' => [
523
+ $container->extension('framework ', [
524
+ 'secret ' => [
528
525
// by convention the env var names are always uppercase
529
- 'url' => '%env(resolve:DATABASE_URL )%',
526
+ 'url' => '%env(string:SECRET )%',
530
527
],
531
528
]);
532
529
};
0 commit comments