API Documentation

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

$kernel  : HydeKernel

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

Methods

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
string

Format a web link to an HTML file, allowing for pretty URLs, if enabled.

public formatLink(string $destination) : string
Parameters
$destination : string
Tags
see
HyperlinkFormatHtmlPathTest
Return values
string

hasSiteUrl()

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
bool

isRemote()

Determine if the given URL is a remote link.

public static isRemote(string $url) : bool
Parameters
$url : string
Return values
bool

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
string

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
see
HyperlinkFileHelperRelativeLinkTest
Return values
string

route()

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|null

url()

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.

Tags
throws
BaseUrlNotSetException

If no site URL is set and no path is provided.

Return values
string

        
On this page

Search results