Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Web controllers and support classes
branch: develop-2

Merge pull request #46 from harikt/auto-dev

Add autoload-dev so FakeResponse is available for tests
latest commit 6b79ef534c
Paul M. Jones pmjones authored


Provides web Request and Response objects for use by web controllers and actions. These are representations of the PHP web environment, not HTTP request and response objects proper.



This library requires PHP 5.3 or later, and has no userland dependencies.

It is installable and autoloadable via Composer as aura/web.

Alternatively, download a release or clone this repository, then require or include its autoload.php file.


Scrutinizer Code Quality Code Coverage Build Status

To run the unit tests at the command line, issue phpunit -c tests/unit/. (This requires PHPUnit to be available as phpunit.)

To run the Aura.Di container configuration tests at the command line, go to the tests/container directory and issue ./ (This requires PHPUnit to be available as phpunit and Composer to be available as composer.)

This library attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.


To ask questions, provide feedback, or otherwise communicate with the Aura community, please join our Google Group, follow @auraphp on Twitter, or chat with us on #auraphp on Freenode.

Getting Started


First, instantiate a WebFactory object, then use it to create Request and Response objects.

use Aura\Web\WebFactory;

$web_factory = new WebFactory($GLOBALS);
$request = $web_factory->newRequest();
$response = $web_factory->newResponse();

Note that if jit-globals is turned on, merely passing $GLOBALS will not work properly. In this case, use compact() to pass the needed values. For example:

use Aura\Web\WebFactory;

$web_factory = new WebFactory(array(
    '_ENV' => $_ENV,
    '_GET' => $_GET,
    '_POST' => $_POST,
    '_COOKIE' => $_COOKIE,
    '_SERVER' => $_SERVER
$request = $web_factory->newRequest();
$response = $web_factory->newResponse();

Request and Response Objects

Because each object contains so much functionality, we have split up the documentation into a Request page and a Response page.

By way of overview, the Request object has these sub-objects ...

... and the Response object has these sub-objects:

Once you have built a Response you can send it with any HTTP mechanism you prefer, including plain PHP.

Be sure to read the Request and Response pages for more detailed information.

Something went wrong with that request. Please try again.