@@ -59,7 +59,7 @@ because that will be explained in the next section)::
5959 /**
6060 * @Route("/", name="homepage")
6161 */
62- public function indexAction ()
62+ public function index ()
6363 {
6464 return $this->render('default/index.html.twig', [
6565 // ...
@@ -69,12 +69,12 @@ because that will be explained in the next section)::
6969
7070In Symfony applications, **controllers ** are usually PHP classes whose names
7171are suffixed with the ``Controller `` word. In this example, the controller
72- is called ``Default `` and the PHP class is called `` DefaultController ``.
72+ is called ``DefaultController ``.
7373
7474The methods defined in a controller are called **actions **, they are usually
7575associated with one URL of the application and their names are suffixed
76- with ``Action ``. In this example, the ``Default `` controller has only one
77- action called ``index `` and defined in the `` indexAction () `` method .
76+ with ``Action ``. In this example, the ``DefaultController `` has only one
77+ action called ``index() ``.
7878
7979Actions are usually very short - around 10-15 lines of code - because they
8080just call other parts of the application to get or generate the needed
@@ -90,7 +90,7 @@ Routing
9090Symfony routes each request to the action that handles it by matching the
9191requested URL against the paths configured by the application. Open again
9292the ``src/Controller/DefaultController.php `` file and take a look
93- at the three lines of code above the ``indexAction () `` method::
93+ at the three lines of code above the ``index () `` method::
9494
9595 // src/Controller/DefaultController.php
9696 namespace App\Controller;
@@ -103,7 +103,7 @@ at the three lines of code above the ``indexAction()`` method::
103103 /**
104104 * @Route("/", name="homepage")
105105 */
106- public function indexAction ()
106+ public function index ()
107107 {
108108 return $this->render('default/index.html.twig', [
109109 // ...
@@ -126,7 +126,7 @@ but later it'll be useful for linking pages.
126126
127127Considering all this, the ``@Route("/", name="homepage") `` annotation creates a
128128new route called ``homepage `` which makes Symfony execute the ``index `` action
129- of the ``Default `` controller when the user browses the ``/ `` path of the application.
129+ of the ``DefaultController `` when the user browses the ``/ `` path of the application.
130130
131131.. tip ::
132132
@@ -175,9 +175,9 @@ Working with Environments
175175-------------------------
176176
177177Now that you have a better understanding of how Symfony works, take a closer
178- look at the bottom of any Symfony rendered page. You should notice a small
179- bar with the Symfony logo. This is the "web debug toolbar" and it is a Symfony
180- developer's best friend!
178+ look at the bottom of any Symfony rendered page. If you've installed the profiler
179+ with `` composer require profiler ``, you should notice a small bar with the Symfony
180+ logo. This is the "web debug toolbar" and it is a Symfony developer's best friend!
181181
182182.. image :: /_images/quick_tour/web_debug_toolbar.png
183183 :align: center
@@ -210,11 +210,12 @@ application. Symfony defines two environments by default: ``dev`` (suited for
210210when developing the application locally) and ``prod `` (optimized for when
211211executing the application on production).
212212
213- When you visit the ``http://localhost:8000 `` URL in your browser, you're
214- executing your Symfony application in the ``dev `` environment. To visit
215- your application in the ``prod `` environment, visit the ``http://localhost:8000/index.php ``
216- URL instead. If you prefer to always show the ``dev `` environment in the
217- URL, you can visit ``http://localhost:8000/index.php `` URL.
213+ The environment is determined by the ``APP_ENV `` environment variable, which is
214+ set in the ``.env `` file while developing. By default, this value is set to ``dev ``.
215+ This means that, right now, hen you visit the ``http://localhost:8000 `` URL in your
216+ browser, you're executing your Symfony application in the ``dev `` environment. To
217+ visit your application in the ``prod `` environment, open your ``.env `` file and
218+ set ``APP_ENV `` to ``prod `` and ``APP_DEBUG `` to ``0 ``.
218219
219220The main difference between environments is that ``dev `` is optimized to
220221provide lots of information to the developer, which means worse application
@@ -224,26 +225,31 @@ toolbar.
224225
225226The other difference between environments is the configuration options used
226227to execute the application. When you access the ``dev `` environment, Symfony
227- loads the ``app/config/config_dev.yml `` configuration file. When you access
228- the ``prod `` environment, Symfony loads ``app/config/config_prod.yml `` file.
228+ loads any configuration files from the ``config/packages/dev `` directory. When you
229+ access the ``prod `` environment, Symfony loads files from the ``config/packages/prod ``
230+ directory.
229231
230232Typically, the environments share a large amount of configuration options.
231- For that reason, you put your common configuration in ``config.yml `` and
232- override the specific configuration file for each environment where necessary:
233+ For that reason, any configuration files stored directly in ``config/packages ``
234+ are loaded in *all * environments. Then, configuration files in the ``dev/ `` sub-directory
235+ can *override * that config.
233236
234237.. code-block :: yaml
235238
236- # app/config/config_dev.yml
237- imports :
238- - { resource: config.yml }
239+ # config/packages/routing.yaml
240+ framework :
241+ router :
242+ strict_requirements : ~
239243
240- web_profiler :
241- toolbar : true
242- intercept_redirects : false
244+ .. code-block :: yaml
245+
246+ # config/packages/dev/routing.yaml
247+ framework :
248+ router :
249+ strict_requirements : true
243250
244- In this example, the ``config_dev.yml `` configuration file imports the common
245- ``config.yml `` file and then overrides any existing web debug toolbar configuration
246- with its own options.
251+ In this example, the ``strict_requirements `` is overridden and set to ``true ``
252+ *only * in the ``dev `` environment.
247253
248254For more details on environments, see
249255:ref: `the "Environments" section <page-creation-environments >` of the
0 commit comments