<?php
namespace app\controller;
use support\Request;
use support\Response;
use support\View;
class SomeController
{
public function index(Request $request): Response
{
View::assign('username', 'Peter');
// some logic which throws an exception
throw new \Exception('some exception');
// view variable $username still alive and available in next requests
return view('index');
}
}
`
Here is an example: