@@ -27,7 +27,7 @@ You can install the component in 2 different ways:
27
27
Request
28
28
-------
29
29
30
- The most common way to create request is to base it on the current PHP global
30
+ The most common way to create a request is to base it on the current PHP global
31
31
variables with
32
32
:method: `Symfony\\ Component\\ HttpFoundation\\ Request::createFromGlobals `::
33
33
@@ -66,7 +66,7 @@ can be accessed via several public properties:
66
66
* ``server ``: equivalent of ``$_SERVER ``;
67
67
68
68
* ``headers ``: mostly equivalent to a sub-set of ``$_SERVER ``
69
- (``$request->headers->get('Content-Type ') ``).
69
+ (``$request->headers->get('User-Agent ') ``).
70
70
71
71
Each property is a :class: `Symfony\\ Component\\ HttpFoundation\\ ParameterBag `
72
72
instance (or a sub-class of), which is a data holder class:
@@ -128,7 +128,7 @@ has some methods to filter the input values:
128
128
parameter value converted to integer;
129
129
130
130
* :method: `Symfony\\ Component\\ HttpFoundation\\ ParameterBag::filter `: Filters the
131
- parameter by using the PHP `` filter_var() ` ` function.
131
+ parameter by using the PHP :phpfunction: ` filter_var ` function.
132
132
133
133
All getters takes up to three arguments: the first one is the parameter name
134
134
and the second one is the default value to return if the parameter does not
@@ -150,7 +150,7 @@ When PHP imports the request query, it handles request parameters like
150
150
``foo[bar]=bar `` in a special way as it creates an array. So you can get the
151
151
``foo `` parameter and you will get back an array with a ``bar `` element. But
152
152
sometimes, you might want to get the value for the "original" parameter name:
153
- ``foo[bar] ``. This is possible with all the `ParameterBag ` getters like
153
+ ``foo[bar] ``. This is possible with all the `` ParameterBag ` ` getters like
154
154
:method: `Symfony\\ Component\\ HttpFoundation\\ Request::get ` via the third
155
155
argument::
156
156
@@ -172,7 +172,8 @@ thanks to the public ``attributes`` property, which is also an instance of
172
172
:class: `Symfony\\ Component\\ HttpFoundation\\ ParameterBag `. This is mostly used
173
173
to attach information that belongs to the Request and that needs to be
174
174
accessed from many different points in your application. For information
175
- on how this is used in the Symfony2 framework, see :ref: `read more<book-fundamentals-attributes> `.
175
+ on how this is used in the Symfony2 framework, see
176
+ :ref: `the Symfony2 book<book-fundamentals-attributes> `.
176
177
177
178
Identifying a Request
178
179
~~~~~~~~~~~~~~~~~~~~~
@@ -188,8 +189,8 @@ this is done via the "path info" of the request, which can be accessed via the
188
189
Simulating a Request
189
190
~~~~~~~~~~~~~~~~~~~~
190
191
191
- Instead of creating a Request based on the PHP globals, you can also simulate
192
- a Request ::
192
+ Instead of creating a request based on the PHP globals, you can also simulate
193
+ a request ::
193
194
194
195
$request = Request::create(
195
196
'/hello-world',
@@ -198,7 +199,7 @@ a Request::
198
199
);
199
200
200
201
The :method: `Symfony\\ Component\\ HttpFoundation\\ Request::create ` method
201
- creates a request based on a path info , a method and some parameters (the
202
+ creates a request based on a URI , a method and some parameters (the
202
203
query parameters or the request ones depending on the HTTP method); and of
203
204
course, you can also override all other variables as well (by default, Symfony
204
205
creates sensible defaults for all the PHP global variables).
@@ -210,19 +211,19 @@ Based on such a request, you can override the PHP global variables via
210
211
211
212
.. tip ::
212
213
213
- You can also duplicate an existing query via
214
+ You can also duplicate an existing request via
214
215
:method: `Symfony\\ Component\\ HttpFoundation\\ Request::duplicate ` or
215
216
change a bunch of parameters with a single call to
216
217
:method: `Symfony\\ Component\\ HttpFoundation\\ Request::initialize `.
217
218
218
219
Accessing the Session
219
220
~~~~~~~~~~~~~~~~~~~~~
220
221
221
- If you have a session attached to the Request , you can access it via the
222
+ If you have a session attached to the request , you can access it via the
222
223
:method: `Symfony\\ Component\\ HttpFoundation\\ Request::getSession ` method;
223
224
the
224
225
:method: `Symfony\\ Component\\ HttpFoundation\\ Request::hasPreviousSession `
225
- method tells you if the request contains a Session which was started in one of
226
+ method tells you if the request contains a session which was started in one of
226
227
the previous requests.
227
228
228
229
Accessing `Accept-* ` Headers Data
@@ -238,7 +239,7 @@ by using the following methods:
238
239
returns the list of accepted languages ordered by descending quality;
239
240
240
241
* :method: `Symfony\\ Component\\ HttpFoundation\\ Request::getCharsets `:
241
- returns the list of accepted charsets ordered by descending quality;
242
+ returns the list of accepted charsets ordered by descending quality.
242
243
243
244
.. versionadded :: 2.2
244
245
The :class: `Symfony\\ Component\\ HttpFoundation\\ AcceptHeader ` class is new in Symfony 2.2.
@@ -262,8 +263,10 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language
262
263
Accessing other Data
263
264
~~~~~~~~~~~~~~~~~~~~
264
265
265
- The Request class has many other methods that you can use to access the
266
- request information. Have a look at the API for more information about them.
266
+ The ``Request `` class has many other methods that you can use to access the
267
+ request information. Have a look at
268
+ :class: `the Request API<Symfony\\ Component\\ HttpFoundation\\ Request> `
269
+ for more information about them.
267
270
268
271
Response
269
272
--------
0 commit comments