How to create URL's from internal route or external URI
Mon, 10/22/2018
// From a route.
$url = Url::fromRoute('contact.site_page');
// From a URI.
$url = Url::fromUri('https://example.com');
// From route with additional parameters.
$url = Url::fromRoute('entity.node.canonical', ['node' => 22]);