tikiwiki/packages/tiki-pkg-mediaalchemyst/symfony/http-foundation
2023-11-20 20:52:04 +00:00
..
File Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
Session Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
Tests Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
.gitignore Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
AcceptHeader.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
AcceptHeaderItem.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
ApacheRequest.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
BinaryFileResponse.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
CHANGELOG.md Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
composer.json Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
Cookie.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
ExpressionRequestMatcher.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
FileBag.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
HeaderBag.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
IpUtils.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
JsonResponse.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
LICENSE Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
ParameterBag.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
phpunit.xml.dist Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
README.md Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
RedirectResponse.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
Request.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
RequestMatcher.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
RequestMatcherInterface.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
RequestStack.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
Response.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
ResponseHeaderBag.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
ServerBag.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00
StreamedResponse.php Update: Tiki 26 path 2023-11-20 20:52:04 +00:00

HttpFoundation Component

HttpFoundation defines an object-oriented layer for the HTTP specification.

It provides an abstraction for requests, responses, uploaded files, cookies, sessions, ...

In this example, we get a Request object from the current PHP global variables:

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

$request = Request::createFromGlobals();
echo $request->getPathInfo();

You can also create a Request directly -- that's interesting for unit testing:

$request = Request::create('/?foo=bar', 'GET');
echo $request->getPathInfo();

And here is how to create and send a Response:

$response = new Response('Not Found', 404, array('Content-Type' => 'text/plain'));
$response->send();

The Request and the Response classes have many other methods that implement the HTTP specification.

Resources

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/HttpFoundation/
$ composer install
$ phpunit