@@ -113,8 +113,11 @@ CSRF Protection
113
113
114
114
Protection against CSRF attacks is built into the Form component, but you need
115
115
to explicitly enable it or replace it with a custom solution. If you want to
116
- use the built-in support, require the Security CSRF component by executing
117
- ``composer require symfony/security-csrf ``.
116
+ use the built-in support, first install the Security CSRF component:
117
+
118
+ .. code-block :: bash
119
+
120
+ $ composer require symfony/security-csrf
118
121
119
122
The following snippet adds CSRF protection to the form factory::
120
123
@@ -160,18 +163,12 @@ to easily render your form as HTML form fields (complete with field values,
160
163
errors, and labels). If you use `Twig `_ as your template engine, the Form
161
164
component offers a rich integration.
162
165
163
- To use the integration, you'll need the ``TwigBridge ``, which provides integration
164
- between Twig and several Symfony components. If you're using Composer, you
165
- could install the latest 2.7 version by adding the following ``require ``
166
- line to your ``composer.json `` file:
166
+ To use the integration, you'll need the twig bridge, which provides integration
167
+ between Twig and several Symfony components:
167
168
168
- .. code-block :: json
169
+ .. code-block :: bash
169
170
170
- {
171
- "require" : {
172
- "symfony/twig-bridge" : " 2.7.*"
173
- }
174
- }
171
+ $ composer require symfony/twig-bridge
175
172
176
173
The TwigBridge integration provides you with several :doc: `Twig Functions </reference/forms/twig_reference >`
177
174
that help you render the HTML widget, label and error for each field
@@ -245,17 +242,11 @@ via your own Twig extension.
245
242
246
243
To use the built-in integration, be sure that your project has Symfony's
247
244
Translation and :doc: `Config </components/config >` components
248
- installed. If you're using Composer, you could get the latest 2.7 version
249
- of each of these by adding the following to your ``composer.json `` file:
245
+ installed:
250
246
251
- .. code-block :: json
247
+ .. code-block :: bash
252
248
253
- {
254
- "require" : {
255
- "symfony/translation" : " 2.7.*" ,
256
- "symfony/config" : " 2.7.*"
257
- }
258
- }
249
+ $ composer require symfony/translation symfony/config
259
250
260
251
Next, add the :class: `Symfony\\ Bridge\\ Twig\\ Extension\\ TranslationExtension `
261
252
to your ``Twig_Environment `` instance::
@@ -296,16 +287,11 @@ no problem! Simply take the submitted/bound data of your form (which is an
296
287
array or object) and pass it through your own validation system.
297
288
298
289
To use the integration with Symfony's Validator component, first make sure
299
- it's installed in your application. If you're using Composer and want to
300
- install the latest 2.7 version, add this to your ``composer.json ``:
290
+ it's installed in your application:
301
291
302
- .. code-block :: json
292
+ .. code-block :: bash
303
293
304
- {
305
- "require" : {
306
- "symfony/validator" : " 2.7.*"
307
- }
308
- }
294
+ $ composer require symfony/validator
309
295
310
296
If you're not familiar with Symfony's Validator component, read more about
311
297
it: :doc: `/validation `. The Form component comes with a
0 commit comments