Skip to content

Commit e539bd1

Browse files
committed
Merge branch '2.7'
* 2.7: (35 commits) Update forms.rst link to the API documentation Re-wording parameters.yml section and removing note about vendor #4608 [#4608] Using #. for numbered bullets Changing and -> or based on conversation in #4532 Changed to definition lists from Book section Changed to definition lists Fixed heading capitalization to follow the standards Changed paragraph to heading Changed unordered list to definition list Spelling mistake tens to tons Removed double `firewall_restriction` entry Normalize the method listings on version 2.5 Update controllers.rst Update the_controller.rst replace Symfony2 with Symfony Linked the PDO/DBAL Session article from the Doctrine category Fix indentation of YAML example Fixed some code indentation Matching up the index position with the map ...
2 parents 2d1c336 + 16668bc commit e539bd1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+646
-510
lines changed

best_practices/controllers.rst

+2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ For example:
136136

137137
.. code-block:: php
138138
139+
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
140+
139141
/**
140142
* @Route("/{id}", name="admin_post_show")
141143
*/

best_practices/creating-the-project.rst

+30-86
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,39 @@ Creating the Project
44
Installing Symfony
55
------------------
66

7-
There is only one recommended way to install Symfony:
7+
In the past, Symfony projects were created with `Composer`_, the dependency manager
8+
for PHP applications. However, the current recommendation is to use the **Symfony
9+
Installer**, which has to be installed before creating your first project.
810

9-
.. best-practice::
10-
11-
Always use `Composer`_ to install Symfony.
12-
13-
Composer is the dependency manager used by modern PHP applications. Adding or
14-
removing requirements for your project and updating the third-party libraries
15-
used by your code is a breeze thanks to Composer.
16-
17-
Dependency Management with Composer
18-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11+
Linux and Mac OS X Systems
12+
~~~~~~~~~~~~~~~~~~~~~~~~~~
1913

20-
Before installing Symfony, you need to make sure that you have Composer installed
21-
globally. Open your terminal (also called *command console*) and run the following
22-
command:
14+
Open your command console and execute the following:
2315

2416
.. code-block:: bash
2517
26-
$ composer --version
27-
Composer version 1e27ff5e22df81e3cd0cd36e5fdd4a3c5a031f4a 2014-08-11 15:46:48
18+
$ curl -LsS http://symfony.com/installer > symfony.phar
19+
$ sudo mv symfony.phar /usr/local/bin/symfony
20+
$ chmod a+x /usr/local/bin/symfony
2821
29-
You'll probably see a different version identifier. Never mind because Composer
30-
is updated on a continuous basis and its specific version doesn't matter.
22+
Now you can execute the Symfony Installer as a global system command called
23+
``symfony``.
3124

32-
Installing Composer Globally
33-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25+
Windows Systems
26+
~~~~~~~~~~~~~~~
3427

35-
In case you don't have Composer installed globally, execute the following two
36-
commands if you use Linux or Mac OS X (the second command will ask for your
37-
user password):
28+
Open your command console and execute the following:
3829

3930
.. code-block:: bash
4031
41-
$ curl -sS https://getcomposer.org/installer | php
42-
$ sudo mv composer.phar /usr/local/bin/composer
32+
c:\> php -r "readfile('http://symfony.com/installer');" > symfony.phar
4333
44-
.. note::
34+
Then, move the downloaded ``symfony.phar`` file to your projects directory and
35+
execute it as follows:
4536

46-
Depending on your Linux distribution, you may need to execute ``su`` command
47-
instead of ``sudo``.
37+
.. code-block:: bash
4838
49-
If you use a Windows system, download the executable installer from the
50-
`Composer download page`_ and follow the steps to install it.
39+
c:\> php symfony.phar
5140
5241
Creating the Blog Application
5342
-----------------------------
@@ -58,64 +47,19 @@ to create files and execute the following commands:
5847

5948
.. code-block:: bash
6049
50+
# Linux, Mac OS X
6151
$ cd projects/
62-
$ composer create-project symfony/framework-standard-edition blog/
63-
64-
This command will create a new directory called ``blog`` that will contain
65-
a fresh new project based on the most recent stable Symfony version available.
66-
67-
Checking the Symfony Installation
68-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69-
70-
Once the installation is finished, enter the ``blog/`` directory and check that
71-
Symfony is correctly installed by executing the following command:
72-
73-
.. code-block:: bash
74-
75-
$ cd blog/
76-
$ php app/console --version
77-
78-
Symfony version 2.6.* - app/dev/debug
79-
80-
If you see the installed Symfony version, everything worked as expected. If not,
81-
you can execute the following *script* to check what does prevent your system
82-
from correctly executing Symfony applications:
83-
84-
.. code-block:: bash
85-
86-
$ php app/check.php
87-
88-
Depending on your system, you can see up to two different lists when executing the
89-
`check.php` script. The first one shows the mandatory requirements which your
90-
system must meet to execute Symfony applications. The second list shows the
91-
optional requirements suggested for an optimal execution of Symfony applications:
92-
93-
.. code-block:: bash
94-
95-
Symfony2 Requirements Checker
96-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97-
98-
> PHP is using the following php.ini file:
99-
/usr/local/zend/etc/php.ini
100-
101-
> Checking Symfony requirements:
102-
.....E.........................W.....
103-
104-
[ERROR]
105-
Your system is not ready to run Symfony2 projects
106-
107-
Fix the following mandatory requirements
108-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109-
110-
* date.timezone setting must be set
111-
> Set the "date.timezone" setting in php.ini* (like Europe/Paris).
112-
113-
Optional recommendations to improve your setup
114-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52+
$ symfony new blog
11553
116-
* short_open_tag should be disabled in php.ini
117-
> Set short_open_tag to off in php.ini*.
54+
# Windows
55+
c:\> cd projects/
56+
c:\projects\> php symfony.phar new blog
11857
58+
This command creates a new directory called ``blog`` that contains a fresh new
59+
project based on the most recent stable Symfony version available. In addition,
60+
the installer checks if your system meets the technical requirements to execute
61+
Symfony applications. If not, you'll see the list of changes needed to meet those
62+
requirements.
11963

12064
.. tip::
12165

@@ -243,7 +187,7 @@ it's released:
243187
└─ web/
244188
245189
The changes are pretty superficial, but for now, we recommend that you use
246-
the Symfony2 directory structure.
190+
the Symfony directory structure.
247191

248192
.. _`Composer`: https://getcomposer.org/
249193
.. _`Get Started`: https://getcomposer.org/doc/00-intro.md

best_practices/forms.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Building Forms
1414

1515
The Form component allows you to build forms right inside your controller
1616
code. Honestly, unless you need to reuse the form somewhere else, that's
17-
totally fine. But for organize and reuse, we recommend that you define each
17+
totally fine. But for organization and reuse, we recommend that you define each
1818
form in its own PHP class::
1919

2020
namespace AppBundle\Form;

best_practices/security.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ Learn More
336336
----------
337337

338338
The `FOSUserBundle`_, developed by the Symfony community, adds support for a
339-
database-backed user system in Symfony2. It also handles common tasks like
339+
database-backed user system in Symfony. It also handles common tasks like
340340
user registration and forgotten password functionality.
341341

342342
Enable the :doc:`Remember Me feature </cookbook/security/remember_me>` to

book/forms.rst

+15-12
Original file line numberDiff line numberDiff line change
@@ -716,14 +716,16 @@ the correct values of a number of field options.
716716
And though you'll need to manually add your server-side validation, these
717717
field type options can then be guessed from that information.
718718

719-
* ``required``: The ``required`` option can be guessed based on the validation
720-
rules (i.e. is the field ``NotBlank`` or ``NotNull``) or the Doctrine metadata
721-
(i.e. is the field ``nullable``). This is very useful, as your client-side
722-
validation will automatically match your validation rules.
719+
``required``
720+
The ``required`` option can be guessed based on the validation rules (i.e. is
721+
the field ``NotBlank`` or ``NotNull``) or the Doctrine metadata (i.e. is the
722+
field ``nullable``). This is very useful, as your client-side validation will
723+
automatically match your validation rules.
723724

724-
* ``maxlength``: If the field is some sort of text field, then the ``maxlength``
725-
option attribute can be guessed from the validation constraints (if ``Length`` or
726-
``Range`` is used) or from the Doctrine metadata (via the field's length).
725+
``max_length``
726+
If the field is some sort of text field, then the ``max_length`` option can be
727+
guessed from the validation constraints (if ``Length`` or ``Range`` is used) or
728+
from the Doctrine metadata (via the field's length).
727729

728730
.. note::
729731

@@ -771,12 +773,13 @@ of code. Of course, you'll usually need much more flexibility when rendering:
771773
You already know the ``form_start()`` and ``form_end()`` functions, but what do
772774
the other functions do?
773775

774-
* ``form_errors(form)`` - Renders any errors global to the whole form
775-
(field-specific errors are displayed next to each field);
776+
``form_errors(form)``
777+
Renders any errors global to the whole form (field-specific errors are displayed
778+
next to each field).
776779

777-
* ``form_row(form.dueDate)`` - Renders the label, any errors, and the HTML
778-
form widget for the given field (e.g. ``dueDate``) inside, by default, a
779-
``div`` element.
780+
``form_row(form.dueDate)``
781+
Renders the label, any errors, and the HTML form widget for the given field
782+
(e.g. ``dueDate``) inside, by default, a ``div`` element.
780783

781784
The majority of the work is done by the ``form_row`` helper, which renders
782785
the label, errors and HTML form widget of each field inside a ``div`` tag by

book/http_cache.rst

+45-37
Original file line numberDiff line numberDiff line change
@@ -202,34 +202,39 @@ method::
202202

203203
Here is a list of the main options:
204204

205-
* ``default_ttl``: The number of seconds that a cache entry should be
206-
considered fresh when no explicit freshness information is provided in a
207-
response. Explicit ``Cache-Control`` or ``Expires`` headers override this
208-
value (default: ``0``);
209-
210-
* ``private_headers``: Set of request headers that trigger "private"
211-
``Cache-Control`` behavior on responses that don't explicitly state whether
212-
the response is ``public`` or ``private`` via a ``Cache-Control`` directive.
213-
(default: ``Authorization`` and ``Cookie``);
214-
215-
* ``allow_reload``: Specifies whether the client can force a cache reload by
216-
including a ``Cache-Control`` "no-cache" directive in the request. Set it to
217-
``true`` for compliance with RFC 2616 (default: ``false``);
218-
219-
* ``allow_revalidate``: Specifies whether the client can force a cache
220-
revalidate by including a ``Cache-Control`` "max-age=0" directive in the
221-
request. Set it to ``true`` for compliance with RFC 2616 (default: false);
222-
223-
* ``stale_while_revalidate``: Specifies the default number of seconds (the
224-
granularity is the second as the Response TTL precision is a second) during
225-
which the cache can immediately return a stale response while it revalidates
226-
it in the background (default: ``2``); this setting is overridden by the
227-
``stale-while-revalidate`` HTTP ``Cache-Control`` extension (see RFC 5861);
228-
229-
* ``stale_if_error``: Specifies the default number of seconds (the granularity
230-
is the second) during which the cache can serve a stale response when an
231-
error is encountered (default: ``60``). This setting is overridden by the
232-
``stale-if-error`` HTTP ``Cache-Control`` extension (see RFC 5861).
205+
``default_ttl``
206+
The number of seconds that a cache entry should be considered fresh when no
207+
explicit freshness information is provided in a response. Explicit
208+
``Cache-Control`` or ``Expires`` headers override this value (default: ``0``).
209+
210+
``private_headers``
211+
Set of request headers that trigger "private" ``Cache-Control`` behavior on
212+
responses that don't explicitly state whether the response is ``public`` or
213+
``private`` via a ``Cache-Control`` directive (default: ``Authorization``
214+
and ``Cookie``).
215+
216+
``allow_reload``
217+
Specifies whether the client can force a cache reload by including a
218+
``Cache-Control`` "no-cache" directive in the request. Set it to ``true`` for
219+
compliance with RFC 2616 (default: ``false``).
220+
221+
``allow_revalidate``
222+
Specifies whether the client can force a cache revalidate by including a
223+
``Cache-Control`` "max-age=0" directive in the request. Set it to ``true`` for
224+
compliance with RFC 2616 (default: false).
225+
226+
``stale_while_revalidate``
227+
Specifies the default number of seconds (the granularity is the second as the
228+
Response TTL precision is a second) during which the cache can immediately
229+
return a stale response while it revalidates it in the background (default:
230+
``2``); this setting is overridden by the ``stale-while-revalidate`` HTTP
231+
``Cache-Control`` extension (see RFC 5861).
232+
233+
``stale_if_error``
234+
Specifies the default number of seconds (the granularity is the second) during
235+
which the cache can serve a stale response when an error is encountered
236+
(default: ``60``). This setting is overridden by the ``stale-if-error`` HTTP
237+
``Cache-Control`` extension (see RFC 5861).
233238

234239
If ``debug`` is ``true``, Symfony automatically adds a ``X-Symfony-Cache``
235240
header to the response containing useful information about cache hits and
@@ -339,11 +344,12 @@ and then returned to every subsequent user who asked for their account page!
339344

340345
To handle this situation, every response may be set to be public or private:
341346

342-
* *public*: Indicates that the response may be cached by both private and
343-
shared caches;
347+
*public*
348+
Indicates that the response may be cached by both private and shared caches.
344349

345-
* *private*: Indicates that all or part of the response message is intended
346-
for a single user and must not be cached by a shared cache.
350+
*private*
351+
Indicates that all or part of the response message is intended for a single
352+
user and must not be cached by a shared cache.
347353

348354
Symfony conservatively defaults each response to be private. To take advantage
349355
of shared caches (like the Symfony reverse proxy), the response will need
@@ -1033,12 +1039,14 @@ possible.
10331039

10341040
The ``render_esi`` helper supports two other useful options:
10351041

1036-
* ``alt``: used as the ``alt`` attribute on the ESI tag, which allows you
1037-
to specify an alternative URL to be used if the ``src`` cannot be found;
1042+
``alt``
1043+
Used as the ``alt`` attribute on the ESI tag, which allows you to specify an
1044+
alternative URL to be used if the ``src`` cannot be found.
10381045

1039-
* ``ignore_errors``: if set to true, an ``onerror`` attribute will be added
1040-
to the ESI with a value of ``continue`` indicating that, in the event of
1041-
a failure, the gateway cache will simply remove the ESI tag silently.
1046+
``ignore_errors``
1047+
If set to true, an ``onerror`` attribute will be added to the ESI with a value
1048+
of ``continue`` indicating that, in the event of a failure, the gateway cache
1049+
will simply remove the ESI tag silently.
10421050

10431051
.. index::
10441052
single: Cache; Invalidation

book/http_fundamentals.rst

+20-18
Original file line numberDiff line numberDiff line change
@@ -518,30 +518,32 @@ libraries that can be used inside *any* PHP project. These libraries, called
518518
the *Symfony Components*, contain something useful for almost any situation,
519519
regardless of how your project is developed. To name a few:
520520

521-
* :doc:`HttpFoundation </components/http_foundation/introduction>` - Contains
522-
the ``Request`` and ``Response`` classes, as well as other classes for handling
523-
sessions and file uploads;
521+
:doc:`HttpFoundation </components/http_foundation/introduction>`
522+
Contains the ``Request`` and ``Response`` classes, as well as other classes for
523+
handling sessions and file uploads.
524524

525-
* :doc:`Routing </components/routing/introduction>` - Powerful and fast routing system that
526-
allows you to map a specific URI (e.g. ``/contact``) to some information
527-
about how that request should be handled (e.g. execute the ``contactAction()``
528-
method);
525+
:doc:`Routing </components/routing/introduction>`
526+
Powerful and fast routing system that allows you to map a specific URI
527+
(e.g. ``/contact``) to some information about how that request should be handled
528+
(e.g. execute the ``contactAction()`` method).
529529

530-
* :doc:`Form </components/form/introduction>` - A full-featured and flexible
531-
framework for creating forms and handling form submissions;
530+
:doc:`Form </components/form/introduction>`
531+
A full-featured and flexible framework for creating forms and handling form
532+
submissions.
532533

533-
* `Validator`_ - A system for creating rules about data and then validating
534-
whether or not user-submitted data follows those rules;
534+
`Validator`_
535+
A system for creating rules about data and then validating whether or not
536+
user-submitted data follows those rules.
535537

536-
* :doc:`Templating </components/templating/introduction>` - A toolkit for rendering
537-
templates, handling template inheritance (i.e. a template is decorated with
538-
a layout) and performing other common template tasks;
538+
:doc:`Templating </components/templating/introduction>`
539+
A toolkit for rendering templates, handling template inheritance (i.e. a
540+
template is decorated with a layout) and performing other common template tasks.
539541

540-
* :doc:`Security </components/security/introduction>` - A powerful library for
541-
handling all types of security inside an application;
542+
:doc:`Security </components/security/introduction>`
543+
A powerful library for handling all types of security inside an application.
542544

543-
* :doc:`Translation </components/translation/introduction>` - A framework for
544-
translating strings in your application.
545+
:doc:`Translation </components/translation/introduction>`
546+
A framework for translating strings in your application.
545547

546548
Each and every one of these components is decoupled and can be used in *any*
547549
PHP project, regardless of whether or not you use the Symfony framework.

0 commit comments

Comments
 (0)