Пример #1
0
<?php

// example.com/web/front.php
require_once __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing;
use Symfony\Component\HttpKernel;
use Framework\Framework;
//Parse request
$request = Request::createFromGlobals();
//Load routes
$routes = (include __DIR__ . '/../app/routes.php');
$context = new Routing\RequestContext();
$matcher = new Routing\Matcher\UrlMatcher($routes, $context);
$resolver = new HttpKernel\Controller\ControllerResolver();
$framework = new Framework($matcher, $resolver);
$response = $framework->handle($request);
$response->send();
Пример #2
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
require 'Framework.php';
\Framework\Framework::registerAutoloader();
$app = new \Framework\Framework();
$request = new \Framework\Request();