ToucaNine
A very simple, yet flexible, PHP5 HMVC-alike micro framework., (*1)
Notice: the source has been revised nearly 6 years after release of v1.1.1. The framework was and is intended as a mock-up for OOP learning. PHP has progressed and matured a lot since v5.4. Many of the techniques used in the framework are now obsoleted in PHP v7.4., (*2)
Components
ToucaNine framework comes packed with Nette HTTP Component, Illuminate Database, and HTML Purifier., (*3)
Requirements
PHP v5.4.0, (*4)
Installation
composer create-project longtimejones/toucanine --prefer-dist
Basic usage instructions
require __DIR__ . '/path/to/src/ToucaNine/Bootstrapper.php';
$app->route('GET /', function () use ($app) {
echo 'Hello, world!';
});
$app->dispatch();
Setup app controller routes, (*5)
$app->route('GET /hello-world', array(
'Welcome', /* App controller */
'helloWorld', /* Controller method */
));
$app->route('GET /hello-user/([^/]+)', array(
'Welcome', /* App controller */
'helloUser', /* Controller method */
'$1', /* Argument passed to method */
));
Configuration file, (*6)
Configuration for machines, Illuminate Database, and HTML Purifier., (*7)
app/Config.php
Executing HTML Purifier app helper, (*8)
$this->helper('Html')->purifier()->purify($value);
Executing Illuminate Database app model, (*9)
$this->model('User')->byUsername($user)->first()
HMVC, (*10)
$this->controller('NameOfYourAppController')->invoke('nameOfControllerMethod', array(
$argument1,
$argument2,
...
));
RESTful, (*11)
$app->route('POST /example/id/([^/]+)', function () use ($app) {
...
});