@@ -113,8 +113,11 @@ CSRF Protection
113113
114114Protection against CSRF attacks is built into the Form component, but you need
115115to 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
118121
119122 The following snippet adds CSRF protection to the form factory::
120123
@@ -160,18 +163,12 @@ to easily render your form as HTML form fields (complete with field values,
160163errors, and labels). If you use `Twig `_ as your template engine, the Form
161164component offers a rich integration.
162165
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:
167168
168- ..code-block ::json
169+ ..code-block ::bash
169170
170- {
171- "require" : {
172- "symfony/twig-bridge" :" 2.7.*"
173- }
174- }
171+ $ composer require symfony/twig-bridge
175172
176173 The TwigBridge integration provides you with several:doc: `Twig Functions </reference/forms/twig_reference >`
177174that help you render the HTML widget, label and error for each field
@@ -245,17 +242,11 @@ via your own Twig extension.
245242
246243To use the built-in integration, be sure that your project has Symfony's
247244Translation 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:
250246
251- ..code-block ::json
247+ ..code-block ::bash
252248
253- {
254- "require" : {
255- "symfony/translation" :" 2.7.*" ,
256- "symfony/config" :" 2.7.*"
257- }
258- }
249+ $ composer require symfony/translation symfony/config
259250
260251 Next, add the:class: `Symfony\\ Bridge\\ Twig\\ Extension\\ TranslationExtension `
261252to your ``Twig_Environment `` instance::
@@ -296,16 +287,11 @@ no problem! Simply take the submitted/bound data of your form (which is an
296287array or object) and pass it through your own validation system.
297288
298289To 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:
301291
302- ..code-block ::json
292+ ..code-block ::bash
303293
304- {
305- "require" : {
306- "symfony/validator" :" 2.7.*"
307- }
308- }
294+ $ composer require symfony/validator
309295
310296 If you're not familiar with Symfony's Validator component, read more about
311297it::doc: `/validation `. The Form component comes with a