(PHP 8 >= 8.5.0)
Uri\Rfc3986\Uri::withScheme — Modify the scheme component
Creates a new URI and modifies its scheme component.
schemeThe modified Uri\Rfc3986\Uri instance.
If the resulting URI is invalid, a Uri\InvalidUriException is thrown.
Example #1 Uri\Rfc3986\Uri::withScheme() basic example
<?php
$uri = new \Uri\Rfc3986\Uri("https://example.com");
$uri = $uri->withScheme("http");
echo $uri->getScheme();
?>Il precedente esempio visualizzerà:
http