Initial commit
This commit is contained in:
commit
5ed6195cc1
41 changed files with 3429 additions and 0 deletions
35
core/Bootstrap.php
Normal file
35
core/Bootstrap.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
header("X-Frame-Options: DENY");
|
||||
|
||||
if (! isset($_SESSION['_token'])) {
|
||||
$_SESSION['_token'] = Illuminate\Support\Str::random(40);
|
||||
}
|
||||
|
||||
use Phroute\Phroute\Dispatcher;
|
||||
use Phroute\Phroute\Exception\HttpMethodNotAllowedException;
|
||||
use Phroute\Phroute\Exception\HttpRouteNotFoundException;
|
||||
use Phroute\Phroute\RouteCollector;
|
||||
use Phroute\Phroute\RouteParser;
|
||||
|
||||
$route = new RouteCollector(new RouteParser);
|
||||
|
||||
require 'Routes.php';
|
||||
|
||||
$dispatcher = new Dispatcher($route->getData());
|
||||
|
||||
try {
|
||||
$response = $dispatcher->dispatch(
|
||||
$_SERVER['REQUEST_METHOD'],
|
||||
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
|
||||
);
|
||||
echo $response;
|
||||
} catch (HttpRouteNotFoundException $e) {
|
||||
header('Location: /404');
|
||||
die();
|
||||
} catch (HttpMethodNotAllowedException $e) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
die();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue