URI Extension
uri is an extension that provides APIs to securely parse and modify URI and URL according to the RFC 3986 and WHATWG URL standards. It is powered by the uriparser, RFC 3986, and Lexbor, WHATWG URL, libraries. It offers the uri class.
This extension is meant to replace the parse_url() function. It also provides two ways to manipulate, parse and produce URLs, which were not available until PHP 8.5.
<?php
// PHP 8.5 and newer
use Uri\Rfc3986\Uri;
$uri = new Uri('https://php.net/releases/8.5/en.php');
var_dump($uri->getHost());
// string(7) php.net
// PHP 8.4 and older
$components = parse_url('https://php.net/releases/8.4/en.php');
var_dump($components['host']);
// string(7) php.net
?>