How to get the current HTTP request URL programmatically in PHP?

/** @return string */
public function getCurrentUrl() {
    /** @var \Magento\Framework\UrlInterface $url */
    $url = \Magento\Framework\App\ObjectManager::getInstance()
        ->get('Magento\Framework\UrlInterface');
    return $url->getCurrentUrl();
}
1 Like

See also: