dev-master
9999999-dev https://github.com/hiroy/karintoa minimal web application framework
BSD-3-Clause
The Requires
- php >=5.3.3
- ext-mbstring *
microframework
Wallogit.com
2017 © Pedro Peláez
a minimal web application framework
Karinto is a minimal application framework for PHP 5.3 or later inspired by Silex based on Lune., (*1)
You can use Twig as a template engine instead of using plain PHP templates., (*2)
<?php
require_once 'Karinto.php';
use Karinto\Application;
use Karinto\Request;
$app = new Application();
$app->templateDir = 'templates';
// if using Twig
// $app->useTwig(array('cache' => 'cache'));
$app->error(function($code, \Exception $e = null) use ($app) {
switch ($code) {
case 404:
$app->render('error_404.php');
break;
default:
$app->render('error_general.php');
break;
}
});
$app->get('/', function(Request $req) use ($app) {
$app->render('default.php');
});
$app->get('/foo', function(Request $req) use ($app) {
$app['name'] = $req->param('name');
$app->render('foo.php');
});
$app->get('/bar', function(Request $req) use ($app) {
$session = $app->session();
$session['name'] = $req->param('name');
$app->redirect('/baz');
});
$app->run();
<html> <body> <p><?php echo h($name); ?></p> </body> </html>
Please access "/index.php/foo?name=bar", (*3)
This code is free to use under the terms of the New BSD License., (*4)
If using Composer as a dependency management tool, you can bring Karinto in your environment easily with settings below., (*5)
{
"minimum-stability": "dev",
"require": {
"karinto/karinto": "1.0.*"
}
}
Using Twig with Karinto, you should set as the same below:, (*6)
{
"minimum-stability": "dev",
"require": {
"karinto/karinto": "1.0.*",
"twig/twig": "1.*"
}
}
a minimal web application framework
BSD-3-Clause
microframework