-
Notifications
You must be signed in to change notification settings - Fork 35
/
index.php
38 lines (26 loc) · 902 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
33
34
35
36
37
38
<?php
namespace MPG; // MongoDB PHP GUI
use Limber\Application;
use Capsule\Factory\ServerRequestFactory;
use Limber\Exceptions\NotFoundHttpException;
const VERSION = '1.3.1';
/**
* Absolute path, without trailing slash.
* Example: /opt/mongodb-php-gui
*/
const ABS_PATH = __DIR__;
session_start();
if ( !file_exists($autoload_file = ABS_PATH . '/vendor/autoload.php') ) {
die('Run `composer install` to complete MongoDB PHP GUI installation.');
}
$loader = require_once $autoload_file;
$loader->add('MPG', ABS_PATH . '/source/php');
$router = require ABS_PATH . '/routes.php';
$application = new Application($router);
$serverRequest = ServerRequestFactory::createFromGlobals();
try {
$response = $application->dispatch($serverRequest);
$application->send($response);
} catch (NotFoundHttpException $_error) {
die('Route not found. Try to append a slash to URL.');
}