Client router is a service that allows you to navigate through pages. Inject Viewi\Common\ClientRouter to use it.
It has the following methods:
How to use:
use Viewi\Common\ClientRouter; class MemberGuard implements IMiddleware { private ClientRouter $router; public function __construct(ClientRouter $clientRouter) { $this->router = $clientRouter; } // ... // somewhere in the code $this->router->navigate("/login"); // or $this->router->navigateBack(); // or $currentUrl = $this->router->getUrl();