-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
49 lines (46 loc) · 1.29 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
require 'vendor/autoload.php';
define("PROJECTPATH", __DIR__);
define("IP", $_SERVER['SERVER_NAME']);
function autoloader($className)
{
$filename = PROJECTPATH . '/' . str_replace('\\', '/', $className) . '.php';
if (is_file($filename)) {
include_once($filename);
}
}
spl_autoload_register('autoloader');
$config = parse_ini_file(PROJECTPATH . '/Database/config.db');
$conf = [
'settings' => [
'displayErrorDetails' => true,
'db' => [
'driver' => 'mysql',
'host' => $config['host'],
'database'=> $config['database'],
'username'=> $config['user'],
'password'=> $config['password'],
'charset' => 'utf8',
'collation'=>'utf8_unicode_ci',
'prefix' => '',
]
],
];
$c = new Slim\Container($conf);
/*$c['errorHandler'] = function ($c) {
return function ($request, $response, $exception) use ($c) {
$data;
$data['status'] = "error";
$data['content'] = "Fatal Error.... Unknow Error";
return $c['response']->withJson($data);
};
};*/
$app = new Slim\App($c);
$container = $app->getContainer();
$capsule = new Illuminate\Database\Capsule\Manager;
$capsule->addConnection($container->get('settings')['db']);
$capsule->setAsGlobal();
$capsule->bootEloquent();
include_once (PROJECTPATH.'/Routes/Routes.php');
$app->run();
?>