File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,43 @@ If you're using forms, but want to avoid starting your session (e.g. using
358
358
forms in an API-only website), ``csrf_protection `` will need to be set to
359
359
``false ``.
360
360
361
+ example:
362
+
363
+ .. configuration-block ::
364
+
365
+ .. code-block :: yaml
366
+
367
+ # config/packages/framework.yaml
368
+ framework :
369
+ # ...
370
+ csrf_protection : true # can be true or false
371
+
372
+ .. code-block :: xml
373
+
374
+ <!-- config/packages/framework.xml -->
375
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
376
+ <container xmlns =" http://symfony.com/schema/dic/services"
377
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
378
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
379
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
380
+ https://symfony.com/schema/dic/services/services-1.0.xsd
381
+ http://symfony.com/schema/dic/symfony
382
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
383
+ <framework : config >
384
+ <framework : csrf-protection enabled =" true" />
385
+ </framework : config >
386
+ </container >
387
+
388
+ .. code-block :: php
389
+
390
+ // config/packages/framework.php
391
+ use Symfony\Config\FrameworkConfig;
392
+ return static function (FrameworkConfig $framework) {
393
+ $framework->csrfProtection()
394
+ ->enabled(true) #can be true or false
395
+ ;
396
+ };
397
+
361
398
.. _config-framework-error_controller :
362
399
363
400
error_controller
You can’t perform that action at this time.
0 commit comments