Skip to content

Commit 392398b

Browse files
committed
Merge branch '2.7'
2 parents 5dd50f5 + f5f8039 commit 392398b

File tree

7 files changed

+98
-77
lines changed

7 files changed

+98
-77
lines changed

best_practices/creating-the-project.rst

+6-26
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,15 @@ In the past, Symfony projects were created with `Composer`_, the dependency mana
88
for PHP applications. However, the current recommendation is to use the **Symfony
99
Installer**, which has to be installed before creating your first project.
1010

11-
Linux and Mac OS X Systems
12-
~~~~~~~~~~~~~~~~~~~~~~~~~~
13-
14-
Open your command console and execute the following:
15-
16-
.. code-block:: bash
17-
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
21-
22-
Now you can execute the Symfony Installer as a global system command called
23-
``symfony``.
24-
25-
Windows Systems
26-
~~~~~~~~~~~~~~~
27-
28-
Open your command console and execute the following:
29-
30-
.. code-block:: bash
31-
32-
c:\> php -r "readfile('http://symfony.com/installer');" > symfony.phar
11+
.. best-practice::
3312

34-
Then, move the downloaded ``symfony.phar`` file to your projects directory and
35-
execute it as follows:
13+
Use the Symfony Installer to create new Symfony-based projects.
3614

37-
.. code-block:: bash
15+
Read the :doc:`installation chapter </book/installation>` of the Symfony Book to
16+
learn how to install and use the Symfony Installer.
3817

39-
c:\> php symfony.phar
18+
.. _linux-and-mac-os-x-systems:
19+
.. _windows-systems:
4020

4121
Creating the Blog Application
4222
-----------------------------

book/installation.rst

+27-24
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ Installing and Configuring Symfony
66

77
The goal of this chapter is to get you up and running with a working application
88
built on top of Symfony. In order to simplify the process of creating new
9-
applications, Symfony provides an installer that must be installed before
10-
creating the first application.
9+
applications, Symfony provides an installer application.
1110

1211
Installing the Symfony Installer
1312
--------------------------------
1413

15-
Using the Symfony Installer is the only recommended way to create new Symfony
16-
applications. This installer is a PHP application that has to be installed
17-
only once and then it can create any number of Symfony applications.
14+
Using the **Symfony Installer** is the only recommended way to create new Symfony
15+
applications. This installer is a PHP application that has to be installed in your
16+
system only once and then it can create any number of Symfony applications.
1817

1918
.. note::
2019

@@ -29,16 +28,14 @@ ways.
2928
Linux and Mac OS X Systems
3029
~~~~~~~~~~~~~~~~~~~~~~~~~~
3130

32-
Open your command console and execute the following three commands:
31+
Open your command console and execute the following commands:
3332

3433
.. code-block:: bash
3534
36-
$ curl -LsS http://symfony.com/installer > symfony.phar
37-
$ sudo mv symfony.phar /usr/local/bin/symfony
38-
$ chmod a+x /usr/local/bin/symfony
35+
$ sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
36+
$ sudo chmod a+x /usr/local/bin/symfony
3937
40-
This will create a global ``symfony`` command in your system that will be used
41-
to create new Symfony applications.
38+
This will create a global ``symfony`` command in your system.
4239

4340
Windows Systems
4441
~~~~~~~~~~~~~~~
@@ -47,21 +44,21 @@ Open your command console and execute the following command:
4744

4845
.. code-block:: bash
4946
50-
c:\> php -r "readfile('http://symfony.com/installer');" > symfony.phar
47+
c:\> php -r "readfile('http://symfony.com/installer');" > symfony
5148
52-
Then, move the downloaded ``symfony.phar`` file to your projects directory and
49+
Then, move the downloaded ``symfony`` file to your project's directory and
5350
execute it as follows:
5451

5552
.. code-block:: bash
5653
57-
c:\> move symfony.phar c:\projects
58-
c:\projects\> php symfony.phar
54+
c:\> move symfony c:\projects
55+
c:\projects\> php symfony
5956
6057
Creating the Symfony Application
6158
--------------------------------
6259

63-
Once the Symfony Installer is ready, create your first Symfony application with
64-
the ``new`` command:
60+
Once the Symfony Installer is available, create your first Symfony application
61+
with the ``new`` command:
6562

6663
.. code-block:: bash
6764
@@ -70,7 +67,7 @@ the ``new`` command:
7067
7168
# Windows
7269
c:\> cd projects/
73-
c:\projects\> php symfony.phar new my_project_name
70+
c:\projects\> php symfony new my_project_name
7471
7572
This command creates a new directory called ``my_project_name`` that contains a
7673
fresh new project based on the most recent stable Symfony version available. In
@@ -87,16 +84,22 @@ to meet those requirements.
8784
Basing your Project on a Specific Symfony Version
8885
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8986

90-
If your project needs to be based on a specific Symfony version, pass the version
91-
number as the second argument of the ``new`` command:
87+
In case your project needs to be based on a specific Symfony version, use the
88+
optional second argument of the ``new`` command:
9289

9390
.. code-block:: bash
9491
95-
# Linux, Mac OS X
96-
$ symfony new my_project_name 2.3.23
92+
# use the most recent version in any Symfony branch
93+
$ symfony new my_project_name 2.3
94+
$ symfony new my_project_name 2.5
95+
$ symfony new my_project_name 2.6
9796
98-
# Windows
99-
c:\projects\> php symfony.phar new my_project_name 2.3.23
97+
# use a specific Symfony version
98+
$ symfony new my_project_name 2.3.26
99+
$ symfony new my_project_name 2.6.5
100+
101+
# use the most recent LTS (Long Term Support) version
102+
$ symfony new my_project_name lts
100103
101104
If you want your project to be based on the latest :ref:`Symfony LTS version <releases-lts>`,
102105
pass ``lts`` as the second argument of the ``new`` command:

components/console/introduction.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ an ``Application`` and adds commands to it::
8585
use Symfony\Component\Console\Application;
8686

8787
$application = new Application();
88-
$application->add(new GreetCommand);
88+
$application->add(new GreetCommand());
8989
$application->run();
9090

9191
Test the new console command by running the following

cookbook/deployment/heroku.rst

+8
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,14 @@ application will respond:
220220
221221
You should be seeing your Symfony application in your browser.
222222

223+
.. caution::
224+
225+
If you take your first steps on Heroku using a fresh installation of
226+
the Symfony Standard Edition, you may run into a 404 page not found error.
227+
This is because the route for ``/`` is defined by the AcmeDemoBundle, but the
228+
AcmeDemoBundle is only loaded in the dev environment (check out your
229+
``AppKernel`` class). Try opening ``/app/example`` from the AppBundle.
230+
223231
.. _`the original article`: https://devcenter.heroku.com/articles/getting-started-with-symfony2
224232
.. _`signup with Heroku`: https://signup.heroku.com/signup/dc
225233
.. _`Heroku Toolbelt`: https://devcenter.heroku.com/articles/getting-started-with-php#local-workstation-setup

cookbook/deployment/platformsh.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ your Git repository which contains the following files:
8989
disk: 2048
9090
9191
An example of these configurations can be found on `GitHub`_. The list of
92-
`available services <configure-services>`_ can be found on the Platform.sh documentation.
92+
`available services`_ can be found on the Platform.sh documentation.
9393

9494
Configure Database Access
9595
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -166,8 +166,8 @@ able to access it in your browser.
166166
Every code change that you do from now on will be pushed to Git in order to
167167
redeploy your environment on Platform.sh.
168168

169-
More information about `migrating your database and files <migrate-existing-site>`_ can be found on the
170-
Platform.sh documentation.
169+
More information about `migrating your database and files`_ can be found
170+
on the Platform.sh documentation.
171171

172172
Deploy a new Site
173173
-----------------
@@ -186,5 +186,5 @@ soon be able to see it in your browser.
186186
.. _`Platform.sh project`: https://marketplace.commerceguys.com/platform/buy-now
187187
.. _`Platform.sh configuration files`: https://docs.platform.sh/reference/configuration-files
188188
.. _`GitHub`: https://github.com/platformsh/platformsh-examples
189-
.. _`configure-services`: https://docs.platform.sh/reference/configuration-files/#configure-services
190-
.. _`migrate-existing-site`: https://docs.platform.sh/toolstacks/symfony/migrate-existing-site/
189+
.. _`available services`: https://docs.platform.sh/reference/configuration-files/#configure-services
190+
.. _`migrating your database and files`: https://docs.platform.sh/toolstacks/php/symfony/migrate-existing-site/

cookbook/security/remember_me.rst

+51-10
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ Once a user is authenticated, their credentials are typically stored in the
88
session. This means that when the session ends they will be logged out and
99
have to provide their login details again next time they wish to access the
1010
application. You can allow users to choose to stay logged in for longer than
11-
the session lasts using a cookie with the ``remember_me`` firewall option.
12-
The firewall needs to have a secret key configured, which is used to encrypt
13-
the cookie's content. It also has several options with default values which
14-
are shown here:
11+
the session lasts using a cookie with the ``remember_me`` firewall option:
1512

1613
.. configuration-block::
1714

@@ -22,9 +19,8 @@ are shown here:
2219
main:
2320
remember_me:
2421
key: "%secret%"
25-
lifetime: 31536000 # 365 days in seconds
22+
lifetime: 604800 # 1 week in seconds
2623
path: /
27-
domain: ~ # Defaults to the current domain from $_SERVER
2824
2925
.. code-block:: xml
3026
@@ -33,9 +29,8 @@ are shown here:
3329
<firewall>
3430
<remember-me
3531
key = "%secret%"
36-
lifetime = "31536000" <!-- 365 days in seconds -->
32+
lifetime = "604800" <!-- 1 week in seconds -->
3733
path = "/"
38-
domain = "" <!-- Defaults to the current domain from $_SERVER -->
3934
/>
4035
</firewall>
4136
</config>
@@ -48,14 +43,60 @@ are shown here:
4843
'main' => array(
4944
'remember_me' => array(
5045
'key' => '%secret%',
51-
'lifetime' => 31536000, // 365 days in seconds
46+
'lifetime' => 604800, // 1 week in seconds
5247
'path' => '/',
53-
'domain' => '', // Defaults to the current domain from $_SERVER
5448
),
5549
),
5650
),
5751
));
5852
53+
The ``remember_me`` firewall defines the following configuration options:
54+
55+
``key`` (default value: ``null``)
56+
The value used to encrypt the cookie's content. It's common to use the
57+
``secret`` value defined in the ``app/config/parameters.yml`` file.
58+
59+
``name`` (default value: ``REMEMBERME``)
60+
The name of the cookie used to keep the user logged in. If you enable the
61+
``remember_me`` feature in several firewalls of the same application, make sure
62+
to choose a different name for the cookie of each firewall. Otherwise, you'll
63+
face lots of security related problems.
64+
65+
``lifetime`` (default value: ``31536000``)
66+
The number of seconds during which the user will remain logged in. By default
67+
users are logged in for one year.
68+
69+
``path`` (default value: ``/``)
70+
The path where the cookie associated with this feature is used. By default
71+
the cookie will be applied to the entire website but you can restrict to a
72+
specific section (e.g. ``/forum``, ``/admin``).
73+
74+
``domain`` (default value: ``null``)
75+
The domain where the cookie associated with this feature is used. By default
76+
cookies use the current domain obtained from ``$_SERVER``.
77+
78+
``secure`` (default value: ``false``)
79+
If ``true``, the cookie associated with this feature is sent to the user
80+
through an HTTPS secure connection.
81+
82+
``httponly`` (default value: ``true``)
83+
If ``true``, the cookie associated with this feature is accessible only
84+
through the HTTP protocol. This means that the cookie won't be accessible
85+
by scripting languages, such as JavaScript.
86+
87+
``remember_me_parameter`` (default value: ``_remember_me``)
88+
The name of the form field checked to decide if the "Remember Me" feature
89+
should be enabled or not. Keep reading this article to know how to enable
90+
this feature conditionally.
91+
92+
``always_remember_me`` (default value: ``false``)
93+
If ``true``, the value of the ``remember_me_parameter`` is ignored and the
94+
"Remember Me" feature is always enabled, regardless of the desire of the
95+
end user.
96+
97+
Forcing the User to Opt-Out of the Remember Me Feature
98+
------------------------------------------------------
99+
59100
It's a good idea to provide the user with the option to use or not use the
60101
remember me functionality, as it will not always be appropriate. The usual
61102
way of doing this is to add a checkbox to the login form. By giving the checkbox

quick_tour/the_big_picture.rst

-11
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,6 @@ On **Linux** and **Mac OS X** systems, execute the following console commands:
3535
$ sudo mv symfony.phar /usr/local/bin/symfony
3636
$ chmod a+x /usr/local/bin/symfony
3737
38-
.. note::
39-
40-
If your system doesn't have cURL installed, execute the following
41-
commands instead:
42-
43-
.. code-block:: bash
44-
45-
$ php -r "readfile('http://symfony.com/installer');" > symfony.phar
46-
$ sudo mv symfony.phar /usr/local/bin/symfony
47-
$ chmod a+x /usr/local/bin/symfony
48-
4938
After installing the Symfony installer, you'll have to open a new console window
5039
to be able to execute the new ``symfony`` command:
5140

0 commit comments

Comments
 (0)