aura/framework-project

A minimal web+cli framework built from Aura v2 packages

2.0.1 2015-03-28 21:45 UTC

This package is auto-updated.

Last update: 2024-09-11 03:47:48 UTC


README

This package provides a minimal framework for combined web and command-line projects.

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.

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.

Foreword

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:

Installation

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

composer create-project aura/framework-project {$PROJECT_PATH}

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

Tests

Build Status

To run the unit tests at the command line, issue ./phpunit.sh at the package root. This requires PHPUnit to be available as phpunit.

Alternatively, after you have installed the project, try the "hello world" CLI and web apps.

For the CLI, go to the project directory and issue the following command:

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!.

For the web, 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 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.)

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.

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.

Services

This package uses services defined by:

This project resets the following services:

  • 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"