-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
51 lines (39 loc) · 1.37 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
50
51
<?php
/**
* Illuminate/Routing
*
* @source https://github.com/illuminate/routing
* @contributor Muhammed Gufran
* @contributor Matt Stauffer
* @contributor https://github.com/jwalton512
* @contributor https://github.com/dead23angel
*/
require_once $_SERVER['DOCUMENT_ROOT']. '/vendor/autoload.php';
use Illuminate\Container\Container;
use Illuminate\Events\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Routing\Router;
use Illuminate\Routing\UrlGenerator;
// Create a service container
$container = new Container;
// Create a request from server variables, and bind it to the container; optional
$request = Request::capture();
$container->instance('Illuminate\Http\Request', $request);
// Using Illuminate/Events/Dispatcher here (not required); any implementation of
// Illuminate/Contracts/Event/Dispatcher is acceptable
$events = new Dispatcher($container);
// Create the router instance
$router = new Router($events, $container);
// Load the routes
require_once 'routes.php';
// Create the redirect instance
$redirect = new Redirector(new UrlGenerator($router->getRoutes(), $request));
// use redirect
// return $redirect->home();
// return $redirect->back();
// return $redirect->to('/');
// Dispatch the request through the router
$response = $router->dispatch($request);
// Send the response back to the browser
$response->send();