Skip to content
[READ-ONLY] Subtree split of the Symfony HttpFoundation Component https://github.com/symfony/symfony
PHP
Latest commit 6edfe4a @nicolas-grekas nicolas-grekas Merge branch '3.0'
* 3.0: (105 commits)
  [Console] remove readline support
  bumped Symfony version to 3.0.3
  updated VERSION for 3.0.2
  updated CHANGELOG for 3.0.2
  [Routing] added a suggestion to add the HttpFoundation component.
  [FrameworkBundle] fix assets and templating tests
  [ClassLoader] fix ApcClassLoader tests on HHVM
  [travis] Add some comments
  changed operator from and to &&
  [DependencyInjection] Remove unused parameter
  [Process] Fix transient tests for incremental outputs
  [Console] Add missing `@require` annotation in test
  Fix merge
  [appveyor] Fix failure reporting
  [#17634] move DebugBundle license file
  Limit Ldap component version for the 3.0 branch
  backport GlobTest from 2.7 branch
  Move licenses according to new best practices
  [FrameworkBundle] Remove unused code in test
  [2.3] Fixed an undefined variable in Glob::toRegex
  ...

Conflicts:
	.travis.yml
	composer.json
	src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
	src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php
	src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml
	src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml
	src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
	src/Symfony/Component/Console/CHANGELOG.md
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/PropertyInfo/Tests/PropertyInfoExtractorTest.php
	src/Symfony/Component/Yaml/Tests/ParserTest.php
Failed to load latest commit information.
File Merge branch '2.3' into 2.7
Session Merge branch '2.8' into 3.0
Tests Merge branch '3.0'
.gitignore Added missing files .gitignore
AcceptHeader.php [2.3] CS And DocBlock Fixes
AcceptHeaderItem.php fixed types in phpdocs
ApacheRequest.php [HttpFoundation] do not use server variable PATH_INFO because it is a…
BinaryFileResponse.php Merge branch '2.3' into 2.7
CHANGELOG.md [HttpFoundation] change precedence of parameters in Request::get
Cookie.php [HttpFoundation][Cookie] Cookie DateTimeInterface fix
ExpressionRequestMatcher.php [HttpFoundation] added ExpressionRequestMatcher
FileBag.php remove api tags from code
HeaderBag.php Merge branch '2.3' into 2.7
IpUtils.php [HttpFoundation] Fixes /0 subnet handling in IpUtils
JsonResponse.php Remove code for PHP <5.5.9
LICENSE Update copyright year
ParameterBag.php [HttpFoundation] Remove deprecated class method parameter
README.md Rely on iconv and symfony/polyfill-*
RedirectResponse.php remove api tags from code
Request.php Merge branch '3.0'
RequestMatcher.php Merge branch '2.3' into 2.7
RequestMatcherInterface.php remove api tags from code
RequestStack.php unified return null usages
Response.php Merge branch '2.8' into 3.0
ResponseHeaderBag.php Merge branch '2.3' into 2.7
ServerBag.php [HttpFoundation] Do not overwrite the Authorization header if it is a…
StreamedResponse.php Add more callable type hints
composer.json updated version to 3.1
phpunit.xml.dist Add missing exclusions from phpunit.xml.dist

README.md

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
Something went wrong with that request. Please try again.