Instantiate URL/URN instances by invoking factory method with valid URI string representation.
$url = Uri::create('http://www.example.com/test.html?name=john&age=28&gender=male#page1');
$urn = Uri::create('urn:isbn:0451450523');Access URL/URN parts through a series of get methods. Returned values are URL encoded.
$url = Uri::create('http://www.example.com/test.html?name=john duncan&age=28&gender=male#page1');
$url->getScheme(); // http
$url->getQueryParams()['name']; // john+duncanTake a relative URL, and resolve it based on the current instance.
$baseUrl = Uri::create('http://www.example.com/parent/child/index.html');
$baseUrl->resolve('rela.html'); // http://www.example.com/parent/child/rela.html
$baseUrl->resolve('../main.html'); // http://www.example.com/parent/main.html
// Supports chaining
$baseUrl->resolve('../main.html')->resolve('rela.html'); // http://www.example.com/parent/rela.html