@@ -91,6 +91,14 @@ to creating a page?
9191 return a ``Response `` object. You'll learn more about :doc: `controllers </controller >`
9292 in their own section, including how to return JSON responses.
9393
94+ .. tip ::
95+
96+ To create controllers faster, let Symfony generate it for you:
97+
98+ .. code-block :: terminal
99+
100+ $ php bin/console make:controller
101+
94102 .. _annotation-routes :
95103
96104Annotation Routes
@@ -126,14 +134,6 @@ You can now add your route directly *above* the controller:
126134 That's it! The page - ``http://localhost:8000/lucky/number `` will work exactly
127135like before! Annotations are the recommended way to configure routes.
128136
129- .. tip ::
130-
131- To create controllers faster, let Symfony generate it for you:
132-
133- .. code-block :: terminal
134-
135- $ php bin/console make:controller
136-
137137.. _flex-quick-intro :
138138
139139Auto-Installing Recipes with Symfony Flex
@@ -176,36 +176,28 @@ To get a list of *all* of the routes in your system, use the ``debug:router`` co
176176
177177 $ php bin/console debug:router
178178
179- You should see your * one * route so far :
179+ You should see your ` app_lucky_number ` route at the very top :
180180
181181================== ======== ======== ====== ===============
182182 Name Method Scheme Host Path
183183================== ======== ======== ====== ===============
184184 app_lucky_number ANY ANY ANY /lucky/number
185185================== ======== ======== ====== ===============
186186
187+ You will also see debugging routes below `app_lucky_number ` -- more on the debugging routes in the next section.
188+
187189You'll learn about many more commands as you continue!
188190
189191The Web Debug Toolbar: Debugging Dream
190192--------------------------------------
191193
192194One of Symfony's *killer * features is the Web Debug Toolbar: a bar that displays
193- a *huge * amount of debugging information along the bottom of your page while developing.
194-
195- To use the web debug toolbar, install the Profiler pack first:
196-
197- .. code-block :: terminal
195+ a *huge * amount of debugging information along the bottom of your page while developing. This is all
196+ included out of the box using a package called ``symfony/profiler-pack ``.
198197
199- $ composer require --dev symfony/profiler-pack
200-
201- As soon as this finishes, refresh your page. You should see a black bar along the
202- bottom of the page. You'll learn more about all the information it holds along the
203- way, but feel free to experiment: hover over and click the different icons to get
204- information about routing, performance, logging and more.
205-
206- This is also a great example of Flex! After downloading the profiler package,
207- the recipe created several configuration files so that the web debug toolbar
208- worked instantly.
198+ You will see a black bar along the bottom of the page. You'll learn more about all the information it holds
199+ along the way, but feel free to experiment: hover over and click
200+ the different icons to get information about routing, performance, logging and more.
209201
210202Rendering a Template
211203--------------------
@@ -214,13 +206,7 @@ If you're returning HTML from your controller, you'll probably want to render
214206a template. Fortunately, Symfony comes with `Twig `_: a templating language that's
215207easy, powerful and actually quite fun.
216208
217- First, install Twig:
218-
219- .. code-block :: terminal
220-
221- $ composer require symfony/twig-bundle
222-
223- Second, make sure that ``LuckyController `` extends Symfony's base
209+ Make sure that ``LuckyController `` extends Symfony's base
224210:class: `Symfony\\ Bundle\\ FrameworkBundle\\ Controller\\ AbstractController ` class:
225211
226212.. code-block :: diff
@@ -251,9 +237,9 @@ variable so you can use it in Twig::
251237 {
252238 $number = random_int(0, 100);
253239
254- return $this->render('lucky/number.html.twig', array(
240+ return $this->render('lucky/number.html.twig', [
255241 'number' => $number,
256- ) );
242+ ] );
257243 }
258244 }
259245
0 commit comments