use Joomla\Uri\Uri; // Create a new Uri object with the starting URL $url = new Uri('https://example.com/'); // Use setQuery to add a new query parameter $url->setQuery('page', 'about'); // Output the updated URL echo $url; // Output: "https://example.com/?page=about"
use Joomla\Uri\Uri; // Create a new Uri object with the starting URL $url = new Uri('https://example.com/?page=about&lang=en'); // Use setQuery to update the "lang" parameter $url->setQuery('lang', 'fr'); // Output the updated URL echo $url; // Output: "https://example.com/?page=about&lang=fr"Package Library: Joomla Framework's Uri package.