Skip to content

Commit 8e33246

Browse files
committed
[HttpFoundation] document Request::getPayload()
1 parent b6bf68e commit 8e33246

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

components/http_foundation.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,17 @@ If the request body is a JSON string, it can be accessed using
216216

217217
$data = $request->toArray();
218218

219+
If the request data could be $_POST data *or* a JSON string, you can use
220+
:method:`Symfony\\Component\\HttpFoundation\\Request::getPayload`
221+
which returns an instance of :class:`Symfony\\Component\\HttpFoundation\\InputBag`
222+
wrapping this data::
223+
224+
$data = $request->getPayload();
225+
226+
.. versionadded:: 6.3
227+
228+
The ``Request::getPayload()`` method was introduced in Symfony 6.3.
229+
219230
Identifying a Request
220231
~~~~~~~~~~~~~~~~~~~~~
221232

0 commit comments

Comments
 (0)