use Joomla\CMS\Uri\Uri; $currentUri = Uri::getInstance()->toString(); echo "Current URI: " . $currentUri;
use Joomla\CMS\Uri\Uri; $currentUri = Uri::getInstance(); $currentUrl = $currentUri->toString(array('scheme', 'host', 'path')); echo "Current URL: " . $currentUrl;
use Joomla\CMS\Uri\Uri; $currentUri = Uri::getInstance(); $currentUri->setQuery('page=about'); echo "Current URI with query parameter: " . $currentUri->toString();This code snippet uses the `setQuery()` method to add a query parameter to the current URI and then uses the `toString()` method to get the updated URI as a string. Package Library: Joomla\CMS\Uri