Aura.Framework_Project
This package provides a minimal framework for combined web and command-line projects., (*1)
By "minimal" we mean very minimal. The package provides only a dependency
injection container, a configuration system, a web router and dispatcher, a CLI dispatcher, a pair of web request and response objects, a pair of CLI context and standard I/O objects, and a logging instance., (*2)
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 dispatchers are built with
iterative refactoring in mind, so you can start with micro-framework-like
closures, and work your way into more complex controller and command objects of
your own design., (*3)
Foreword
Requirements
This project requires PHP 5.4 or later; we recommend using the latest available version of PHP as a matter of principle., (*4)
Unlike Aura library packages, this project package has userland dependencies, which themselves may have other dependencies:, (*5)
Installation
Install this project via Composer to a {$PROJECT_PATH}
of your choosing:, (*6)
composer create-project aura/framework-project {$PROJECT_PATH}
This will create the project skeleton and install all of the necessary packages., (*7)
Tests
, (*8)
To run the unit tests at the command line, issue ./phpunit.sh
at the package root. This requires PHPUnit to be available as phpunit
., (*9)
Alternatively, after you have installed the project, try the "hello world" CLI and web apps., (*10)
For the CLI, go to the project directory and issue the following command:, (*11)
cd {$PROJECT_PATH}
php cli/console.php hello
You should see the output Hello World!
. Try passing a name after hello
to
see Hello name!
., (*12)
For the web, start the built-in PHP server with the web/
directory as the document root:, (*13)
cd {$PROJECT_PATH}
php -S localhost:8000 -t web/
When you browse to http://localhost:8000 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.), (*14)
PSR Compliance
This projects attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request., (*15)
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., (*16)
Services
This package uses services defined by:, (*17)
This project resets the following services:, (*18)
-
logger
: an instance of Monolog\Logger
Getting Started
This framework project package is not much more than a combination of the CLI and web project packages. Please see them for their respective "getting started" instructions", (*19)