php - Phalcon 4 How to get URL of current page?

In phalcon 3.4 we had the below function to get the current URL,

$current_url = $this->router->getRewriteUri();

However, it seems to be that, it was dropped in version 4.0 however there is no direct corresponding function for this i could find. Can you please let me know how to change this function to adapt to version 4.0+ Or should i just use the direct way (I usually hate to mix things up) but looks like no other choice

$_SERVER['REQUEST_URI']

Answer

Solution:

you can use Phalcon\Http\Request::getURI() but it uses $_SERVER['REQUEST_URI'] if your project is not on root path you may want to use $_GET['_url']

Source