PHPackages                             aura/web-project - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. aura/web-project

ActiveProject[Framework](/categories/framework)

aura/web-project
================

A minimal web framework built from Aura v2 packages

2.0.2(11y ago)601.6k11BSD-2-ClausePHP

Since Apr 15Pushed 11y ago14 watchersCompare

[ Source](https://github.com/auraphp/Aura.Web_Project)[ Packagist](https://packagist.org/packages/aura/web-project)[ RSS](/packages/aura-web-project/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Aura.Web\_Project
=================

[](#auraweb_project)

This package provides a minimal framework for web projects.

By "minimal" we mean *very* minimal. The package provides only a dependency injection container, a configuration system, a router, a dispatcher, a pair of request and response objects, and a logging instance.

This minimal implementation should not be taken as "restrictive". The DI container, with its two-stage configuration system, allows a wide range of programmatic service definitions. The router and dispatcher are built with iterative refactoring in mind, so you can start with micro-framework-like closure controllers, and work your way into more complex controller objects of your own design.

Foreword
--------

[](#foreword)

### Requirements

[](#requirements)

This project requires PHP 5.4 or later; we recommend using the latest available version of PHP as a matter of principle.

Unlike Aura library packages, this project package has userland dependencies, which themselves may have other dependencies:

- [aura/web-kernel](https://packagist.org/packages/aura/web-kernel)
- [monolog/monolog](https://packagist.org/packages/monolog/monolog)

### Installation

[](#installation)

Install this project via Composer to a `{$PROJECT_PATH}` of your choosing:

```
composer create-project aura/web-project {$PROJECT_PATH}

```

This will create the project skeleton and install all of the necessary packages.

### Tests

[](#tests)

[![Build Status](https://camo.githubusercontent.com/4147aff2c0b7fb06a802eb4940baa2c2f2f605e715316462f7fec90bea04f8c0/68747470733a2f2f7472617669732d63692e6f72672f617572617068702f417572612e5765625f50726f6a6563742e706e67)](https://travis-ci.org/auraphp/Aura.Web_Project)

To run the unit tests at the command line, issue `./phpunit.sh` at the package root. This requires [PHPUnit](http://phpunit.de/) to be available as `phpunit`.

Alternatively, after you have installed the project, start the built-in PHP server with the `web/` directory as the document root:

```
cd {$PROJECT_PATH}
php -S localhost:8000 -t web/

```

When you browse to  you should see "Hello World!" as the output. Terminate the built-in server process thereafter. (Be sure to use the built-in PHP server only for testing, never for production.)

### PSR Compliance

[](#psr-compliance)

This projects attempts to comply with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

### Community

[](#community)

To ask questions, provide feedback, or otherwise communicate with the Aura community, please join our [Google Group](http://groups.google.com/group/auraphp), follow [@auraphp on Twitter](http://twitter.com/auraphp), or chat with us on #auraphp on Freenode.

### Services

[](#services)

This package uses services defined by:

- [Aura.Project\_Kernel](https://github.com/auraphp/Aura.Project_Kernel#services)
- [Aura.Web\_Kernel](https://github.com/auraphp/Aura.Web_Kernel#services)

This project resets the following services:

- `aura/project-kernel:logger`: an instance of `Monolog\Logger`

Getting Started
---------------

[](#getting-started)

### Component Packages

[](#component-packages)

This project combines a collection of independent Aura packages into a cohesive whole. The operation of each package is documented separately.

The dependency injection *Container* is absolutely central to the operation of an Aura project. Please be familiar with [the Aura.Di docs](https://github.com/auraphp/Aura.Di) before continuing.

You should also familiarize yourself with [Aura.Router](https://github.com/auraphp/Aura.Router), [Aura.Dispatcher](https://github.com/auraphp/Aura.Dispatcher), and the [Aura.Web](https://github.com/auraphp/Aura.Web) *Request* and *Response* objects.

### Project Configuration

[](#project-configuration)

Every Aura project is configured the same way. Please see the [shared configuration docs](https://github.com/auraphp/Aura.Project_Kernel#configuration) for more information.

### Logging

[](#logging)

The project automatically logs to `{$PROJECT_PATH}/tmp/log/{$mode}.log`. If you want to change the logging behaviors for a particular config mode, edit the related config file (e.g., `config/Dev.php`) file to modify the `aura/project-kernel:logger` service.

### Routing and Dispatching

[](#routing-and-dispatching)

We configure routing and dispatching via the project-level `config/`class files. If a route needs to be available in every config mode, edit the project-level `config/Common.php` class file. If it only needs to be available in a specific mode, e.g. `dev`, then edit the config file for that mode.

Here are three different styles of routing and dispatching.

#### Micro-Framework Style

[](#micro-framework-style)

Aura is the first framework which follows the [Action Domain Responder](https://github.com/pmjones/mvc-refinement) pattern. The following is an example of a micro-framework style route, where the action logic is embedded in the route params. In the `modifyWebRouter()`config method, we retrieve the shared `aura/web-kernel:request` and `aura/web-kernel:response` services, along with the `aura/web-kernel:router`service. We then add a route names `blog.read` and embed the action code as a closure.

```
