(PHP 8 >= 8.5.0)
Uri\Rfc3986\Uri::withScheme — Modify the scheme component
$scheme
Creates a new URI and modifies its scheme component.
scheme
New scheme component.
The 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(); ?>
The above example will output:
http