<?php use Foundation\Application; use HTTP\Kernel; use HTTP\Request; use Routing\Router; require __DIR__ . '/../vendor/autoload.php'; $application = new Application(); $application->share('i want to see the dashboard', function () { echo '<h1>Dashboard</h1>'; }); $router = new Router(); $router->add('/', 'i want to see the dashboard'); $kernel = new Kernel($router, $application); $request = Request::create('/', 'GET'); $response = $kernel->handle($request); $response->send();
<?php use Foundation\Application; use HTTP\Kernel; use HTTP\Request; use HTTP\Session; use Routing\Router; require __DIR__ . '/../vendor/autoload.php'; $application = new Application(); $application->share('HTTP\\Session', function () { return new Session(); }); $application->share('i want to save to the session', function (Session $session) { $session->name = 'Reno Jackson'; $session->quotes = 'We\'re gonna be rich'; }); $application->share('i want to read the session', function (Session $session) { dump($session); }); $application->share('i want to flash to the session', function (Session $session) { // $session->flash->city = 'Nijmegen'; }); $application->share('i want to read the session flash', function (Session $session) { dump($session->flash); }); $router = new Router(); $router->add('/', 'i want to save to the session'); $router->add('/read', 'i want to read the session'); $router->add('/add/flash', 'i want to flash to the session'); $router->add('/read/flash', 'i want to read the session flash'); $kernel = new Kernel($router, $application);