Hyperlinks
in package
Contains helpers and logic for resolving web paths for compiled files.
It's bound to the HydeKernel instance, and is an integral part of the framework.
Table of Contents
Properties
Methods
- __construct() : mixed
- asset() : string
- Gets a relative web link to the given image stored in the _site/media folder.
- formatLink() : string
- Format a web link to an HTML file, allowing for pretty URLs, if enabled.
- hasSiteUrl() : bool
- Check if a site base URL has been set in config (or .env).
- isRemote() : bool
- Determine if the given URL is a remote link.
- mediaLink() : string
- Gets a relative web link to the given file stored in the _site/media folder.
- relativeLink() : string
- Inject the proper number of `../` before the links in Blade templates.
- route() : Route|null
- Get a route instance by its key from the kernel's route collection.
- url() : string
- Return a qualified URL to the supplied path if a base URL is set.
Properties
$kernel
protected
HydeKernel
$kernel
Methods
__construct()
public
__construct(HydeKernel $kernel) : mixed
Parameters
- $kernel : HydeKernel
asset()
Gets a relative web link to the given image stored in the _site/media folder.
public
asset(string $name[, bool $preferQualifiedUrl = false ]) : string
If the image is remote (starts with http) it will be returned as is.
If true is passed as the second argument, and a base URL is set, the image will be returned with a qualified absolute URL.
Parameters
- $name : string
- $preferQualifiedUrl : bool = false
Return values
stringformatLink()
Format a web link to an HTML file, allowing for pretty URLs, if enabled.
public
formatLink(string $destination) : string
Parameters
- $destination : string
Tags
Return values
stringhasSiteUrl()
Check if a site base URL has been set in config (or .env).
public
hasSiteUrl() : bool
The default value is http://localhost
, which is not considered a valid site URL.
Return values
boolisRemote()
Determine if the given URL is a remote link.
public
static isRemote(string $url) : bool
Parameters
- $url : string
Return values
boolmediaLink()
Gets a relative web link to the given file stored in the _site/media folder.
public
mediaLink(string $destination[, bool $validate = false ]) : string
This method will be removed in v2.0. Please use asset()
instead.
An exception will be thrown if the file does not exist in the _media directory, and the second argument is set to true.
Parameters
- $destination : string
- $validate : bool = false
Attributes
- #[Deprecated]
- $reason: 'Use `asset` method instead.'
- $replacement: '%class%->asset(%parameter0%)'
Return values
stringrelativeLink()
Inject the proper number of `../` before the links in Blade templates.
public
relativeLink(string $destination) : string
Parameters
- $destination : string
-
relative to output directory on compiled site
Tags
Return values
stringroute()
Get a route instance by its key from the kernel's route collection.
public
route(string $key) : Route|null
Parameters
- $key : string
Return values
Route|nullurl()
Return a qualified URL to the supplied path if a base URL is set.
public
url([string $path = '' ]) : string
Parameters
- $path : string = ''
-
An optional relative path suffix. Omit to return the base URL.