-
Notifications
You must be signed in to change notification settings - Fork 3
URL Generation
Benjamin Khalife edited this page Sep 16, 2020
·
5 revisions
The url helper may be used to generate arbitrary URLs for your application. The generated URL will automatically use the scheme (HTTP or HTTPS) and host from the current request:
echo url("/posts/$title");
// https://example.com/posts/hello-world
Accessing The Current URL
If no path is provided to the url helper, a webrium\core\Url instance is returned, allowing you to access information about the current URL:
// Get the current URL without the query string...
echo Url::current();
// or
echo current_url();
// Get the current URL including the query string...
echo Url::full();
// Get the current domain name
echo Url::domain();
use webrium\core\Url;
echo Url::current();