Lune is a PHP minimal framework for web applications.
- PHP 5.1 or higher
- mbstring
<?php
require_once 'Lune.php';
Lune::get('/', 'myapp_default');
function myapp_default(Lune_Request $req, Lune_Response $res)
{
$res->output('This is a test page');
}
Lune::get('/foo', 'myapp_foo');
function myapp_foo(Lune_Request $req, Lune_Response $res)
{
$res->contentTypeHtml('UTF-8');
$res->message = 'Hello ' . $req->name;
$res->render(); // equals to $res->render('myapp_foo.php');
}
// PHP version >= 5.3.0
Lune::get('/bar', function(Lune_Request $req, Lune_Response $res) {
$res->render('myapp_foo.php');
});
Lune::run();
<html>
<body>
<p><?php echo h($message); ?></p>
</body>
</html>
Please access "/index.php/foo?name=bar"
This code is free to use under the terms of the New BSD License.