Add Router to core.

This commit is contained in:
Maarten 2019-12-24 00:31:29 +01:00
parent 246bbed148
commit 69c761c3b1
58 changed files with 6451 additions and 157 deletions

View file

@ -2,20 +2,27 @@
namespace Runtime\Factory;
use ClassNotFoundException;
use Pecee\SimpleRouter\SimpleRouter;
use Runtime\Exceptions\ClassNotFoundException;
use Runtime\Http\View\ViewEngine;
use Runtime\Router\Route;
use Runtime\Exceptions\ExceptionHandler;
use Runtime\Router\Router;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
class BootstrapFactory {
public function handle()
{
SimpleRouter::setDefaultNamespace('\App\Http\Controllers');
Route::setDefaultNamespace('\App\Http\Controllers');
require_once('../routes/web.php ');
require_once('../routes/web.php');
// start engines
app(ViewEngine::class);
try {
SimpleRouter::start();
Route::start();
}
catch (\Exception $e) {
ExceptionHandler::make($e);
@ -52,4 +59,12 @@ class BootstrapFactory {
return "../resources/";
}
/**
* @return Environment
*/
public function view()
{
return ViewEngine::get();
}
}