GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - auraphp/Aura.Web: Web controllers and support classes

BranchesTags
Open more actions menu

Latest commit

 

History

426 Commits
426 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
config
config
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.scrutinizer.yml
.scrutinizer.yml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README-REQUEST.md
README-REQUEST.md
 
 
README-RESPONSE.md
README-RESPONSE.md
 
 
README.md
README.md
 
 
autoload.php
autoload.php
 
 
codecov.yml
codecov.yml
 
 
composer.json
composer.json
 
 
phpunit.php
phpunit.php
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 

Repository files navigation

Aura.Web

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.

Foreword

Installation

This library requires PHP 5.3 or later; we recommend using the latest available version of PHP as a matter of principle. It 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.

Quality

Scrutinizer Code Quality codecov Continuous Integration

To run the unit tests at the command line, issue composer install and then ./vendor/bin/phpunit at the package root. This requires 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.

Community

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

Instantiation

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

<?php
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:

<?php
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 ...

  • $request->cookies for $_COOKIES
  • $request->env for $_ENV
  • $request->files for $_FILES
  • $request->post for $_POST
  • $request->query for $_GET
  • $request->server for $_SERVER
  • $request->client for the client making the request
  • $request->content for the raw body of the request
  • $request->headers for the request headers
  • $request->method for the request method
  • $request->params for path-info parameters
  • $request->url for the request URL

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

  • $response->status for the status code, status phrase, and HTTP version
  • $response->headers for non-cookie headers
  • $response->cookies for cookie headers
  • $response->content for describing the response content, and for convenience methods related to content type, charset, disposition, and filename
  • $response->cache for convenience methods related to cache headers
  • $response->redirect for convenience methods related to Location and Status

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.

About

Web controllers and support classes

Topics

auracookie-headercookiesheadersphprequestresponse

Resources

Readme
BSD-2-Clause license

Contributing

Contributing
Activity
Custom properties

Stars

82 stars

Watchers

13 watching

Forks

25 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.