A lightweight php5 library for request/response routing, controllers and http interaction.
PHP
Latest commit 8fbcfe6 Jul 10, 2015 @pda pda Merge pull request #23 from 99designs/v2-remove-type-hints
V2: remove addFilter() type hints
Permalink
Failed to load latest commit information.
classes Remove type-hints from addFilter() Jul 10, 2015
script Fix cibuild Jan 6, 2014
tests Fix test Jan 6, 2014
.gitignore Use Composer to manage development dependencies Jun 20, 2012
LICENSE
README.md Show sample output from phpunit Jan 3, 2013
composer.json Add dependency for psr/log Jan 6, 2014
ergo.php Migrated to use PHP 5.3 packages and closures where appropriate Oct 26, 2010
phpunit.xml.dist Convert tests from SimpleTest to PHPUnit Dec 20, 2012

README.md

Ergo

A light-weight library for processing requests and responses in PHP5.3. Provides a closure-based infrastructure for routing, controllers and templating.

The name is from the latin, Cogito ergo sum. "I think, therefore I am".

Install

Ergo is designed to be easy to install and integrate.

$ pear channel-discover pearhub.org
$ pear install pearhub/Ergo

Alternately, check it out as a submodule and use your own classloader on the classes dir.

Basic Usage

require_once('Ergo/ergo.php');

Ergo::router()->connect('/helloworld', 'helloworld', function() {
    return Ergo::template('helloworld.tpl.php', array(
      'greeting'=>'Hello World'
    ));
});

Ergo::router()->connect('/*', 'any', function() {
    throw new \Ergo\Http\NotFound("Not implemented yet");
});

How to develop

For running, Ergo has no external dependancies. For development Composer is used to pull in SimpleTest as a dependancy.

To install dependancies via Composer:

$ composer install --dev

Run the test suite:

$ phpunit
PHPUnit 3.7.10 by Sebastian Bergmann.

Configuration read from /home/vagrant/ergo/phpunit.xml.dist

...............................................................  63 / 100 ( 63%)
.....................................

Time: 0 seconds, Memory: 11.25Mb

OK (100 tests, 269 assertions)

Status

Used in several high-volume production websites, including 99designs.com, flippa.com, learnable.com and sitepoint.com.