This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/HttpFoundation
2012-07-09 14:43:50 +02:00
..
File fixed CS (mainly method signatures) 2012-07-09 14:43:50 +02:00
SessionStorage fixed CS (mainly method signatures) 2012-07-09 14:43:50 +02:00
ApacheRequest.php [HttpFoundation] fixed ApacheRequest 2011-12-21 13:57:56 -08:00
composer.json removed the version attribute in all composer.json files 2012-01-05 14:51:20 +01:00
Cookie.php fixed phpdoc @param alignment 2012-05-15 18:56:32 +02:00
FileBag.php fixed CS (mainly method signatures) 2012-07-09 14:43:50 +02:00
HeaderBag.php fixed phpdoc @param alignment 2012-05-15 18:56:32 +02:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
ParameterBag.php fixed phpdoc @param alignment 2012-05-15 18:56:32 +02:00
README.md tweaked the README files 2011-12-18 14:22:28 +01:00
RedirectResponse.php [RedirectResponse] Added missing doctype and title tag 2011-08-24 05:31:42 +03:00
Request.php fixed CS (mainly method signatures) 2012-07-09 14:43:50 +02:00
RequestMatcher.php change explode's limit parameter based on known variable content 2011-12-11 21:58:35 +01:00
RequestMatcherInterface.php fixed CS (mainly method signatures) 2012-07-09 14:43:50 +02:00
Response.php fixed CS (mainly method signatures) 2012-07-09 14:43:50 +02:00
ResponseHeaderBag.php [DoctrineBridge] fixed some CS 2011-12-13 10:22:12 +01:00
ServerBag.php Authorization header should only be rebuild when Basic Auth scheme is used 2012-06-12 08:10:53 +02:00
Session.php [HttpFoundation] changed the strategy introduced in a5ccda47b4 to fix functional tests and still allow to call save more than once for a Session 2011-09-14 20:54:45 +02: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

Unit tests:

https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/HttpFoundation