コード例 #1
0
    $app->config(array('log.level' => \Slim\Log::WARN, 'log.enable' => true, 'debug' => false));
});
$app->configureMode('development', function () use($app) {
    $app->config(array('log.enable' => false, 'debug' => true));
});
//Use the layout class if not Ajax request
if (!$app->request()->isAjax()) {
    $app->view(new SlimBoilerplate\Layout\LayoutView());
    $app->notFound(function () use($app) {
        include "404.html";
    });
}
// ########################################
// ###### DEFAULT LAYOUT CONFIG ###########
SlimBoilerplate\Layout\LayoutView::addCss('assets/css/vendor/normalize.min.css');
SlimBoilerplate\Layout\LayoutView::addCss('assets/css/style.css');
SlimBoilerplate\Layout\LayoutView::addJs('assets/js/vendor/modernizr-2.6.2-custom.min.js');
//SlimBoilerplate\Layout\LayoutView::setDefaultDescription('Slim PHP boilerplate');
// ########################################
// ############### ROUTES #################
// REST API
// Very simple Rest server for the "account" sql table
$restAccounts = new \SlimBoilerplate\Rest\RestServer('account');
$restAccounts->createRoutes($app);
// HTML
$app->get('/', function () use($app) {
    $app->render('home.php');
})->name('home');
$app->get('/error', function () use($app) {
    $app->render('error.php');
})->name('error');