|
2 | 2 | single: Page creation
|
3 | 3 |
|
4 | 4 | .. _creating-pages-in-symfony2:
|
| 5 | +.. _creating-pages-in-symfony: |
5 | 6 |
|
6 |
| -Creating Pages in Symfony |
7 |
| -========================= |
| 7 | +Create your First Page in Symfony |
| 8 | +================================= |
8 | 9 |
|
9 |
| -Creating a new page in Symfony is a simple two-step process: |
| 10 | +Creating a new page - whether it's an HTML page or a JSON endpoint - is a |
| 11 | +simple two-step process: |
10 | 12 |
|
11 |
| -* *Create a route*: A route defines the URL (e.g. ``/about``) to your page |
12 |
| - and specifies a controller (which is a PHP function) that Symfony should |
13 |
| - execute when the URL of an incoming request matches the route path; |
| 13 | +#. *Create a route*: A route is the URL (e.g. ``/about``) to your page and |
| 14 | + points to a controller; |
14 | 15 |
|
15 |
| -* *Create a controller*: A controller is a PHP function that takes the incoming |
16 |
| - request and transforms it into the Symfony ``Response`` object that's |
17 |
| - returned to the user. |
| 16 | +#. *Create a controller*: A controller is the function you write that builds |
| 17 | + the page. You take the incoming request information and use it to create |
| 18 | + a Symfony ``Response``, which could hold HTML content, a JSON string or |
| 19 | + anything else. |
18 | 20 |
|
19 |
| -This simple approach is beautiful because it matches the way that the Web works. |
20 |
| -Every interaction on the Web is initiated by an HTTP request. The job of |
21 |
| -your application is simply to interpret the request and return the appropriate |
| 21 | +Just like on the web, every interaction is initiated by an HTTP request. |
| 22 | +Your job is pure and simple: understand that request and return the appropriate |
22 | 23 | HTTP response.
|
23 | 24 |
|
24 |
| -Symfony follows this philosophy and provides you with tools and conventions |
25 |
| -to keep your application organized as it grows in users and complexity. |
26 |
| - |
27 | 25 | .. index::
|
28 | 26 | single: Page creation; Environments & Front Controllers
|
29 | 27 |
|
|
0 commit comments