Laminas Uri Class

Code
<?php

use Laminas\Uri\Uri;

$uri = new Uri('http://www.google.com/?q=laminas');

$uri->setHost('bing.com');
echo 
$uri PHP_EOL;

$uri->setQuery(array('q' => 'php'));

if (
$uri->isValid()) {
    echo 
$uri;
}
Result
http://bing.com/?q=laminas
http://bing.com/?q=php
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8