-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
executable file
·32 lines (27 loc) · 926 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
putenv("env=development");
error_reporting(~E_NOTICE);
require_once 'vendor/autoload.php';
use \Fleet\Utils as Utils;
// needed when installed into subdirectory
// check https://github.com/chriso/klein.php/wiki/Sub-Directory-Installation
// $base = dirname($_SERVER['PHP_SELF']);
// if(ltrim($base, '/')){
// $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], strlen($base));
// }
$klein = new \Klein\Klein();
$config = \Fleet\Config::getInstance();
$db = \Fleet\DB::getInstance();
$template = \Fleet\Template::getInstance();
$klein->config = $config;
$klein->db = $db;
$klein->template = $template;
// route for /
$klein->respond('GET', '/', function ($request, $response, $service, $app) use ($klein) {
$response->redirect($klein->config->app->url."/hello/".$klein->config->app->author);
});
foreach (glob("application/controllers/*.php") as $filename)
{
include $filename;
}
$klein->dispatch();