-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
50 lines (40 loc) · 1.76 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
<?php
use App\config\App;
use App\Integra\Framework;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\Routing\Loader\YamlFileLoader;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Router;
require_once './vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
date_default_timezone_set('America/Mexico_City');
error_reporting(E_ALL);//muestra todos los errores
// error_reporting(E_ERROR | E_WARNING | E_PARSE);//muestra solo errores warning o errores de sintaxis
//error_reporting(E_ERROR | E_PARSE);//muestra todos los errores
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
session_start();
App::Config();
const DIR_ROOT = __DIR__;
const VIEW_PATH = __DIR__. '/resource/views/';
$request = Request::createFromGlobals();
$options = array(
'cache_dir' => 'cache/', //directorio donde serán cacheadas las rutas
);
$requestContext = new RequestContext();
$requestContext->fromRequest(Request::createFromGlobals());
$fileLocator = new FileLocator(array('app/config/')); // nos ubicamos en la carpeta app/config
$loader = new YamlFileLoader($fileLocator); //creamos el loader
$router = new Router($loader, 'routing.yml', $options, $requestContext);
$routes = $router->getRouteCollection();
$matcher = new UrlMatcher($routes, $requestContext);
$controllerResolver = new ControllerResolver();
$argumentResolver = new ArgumentResolver();
$framework = new Framework($matcher, $controllerResolver, $argumentResolver);
$response = $framework->handle($request);
$response->send();