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