Link
Link
Represents a early hint link for HTTP/2 or HTTP/3.
This class is used to create and manage HTTP Link headers, which are used to provide hints to the client about resources that should be preloaded or prefetched. The Link header is typically used in the response headers of an HTTP request to inform the client about additional resources that may be needed for rendering the page.
Properties
href
public string $hrefattributes
The relationship between the current document and the linked resource.
public array $attributesMethods
__construct
public __construct(?string $href, ?string $rel = 'preload'): voidParameters
| Parameter | Type | Description |
|---|---|---|
$href | string | |
$rel | string |
__toString
Converts the Link object to its string representation.
public __toString(): stringThis method generates a string representation of the Link object in the format of an HTTP Link header. The href property is used as the main URL, and any additional attributes are appended as key-value pairs.
attr
Sets an attribute for the link and returns the current instance.
public attr(string $name, string $value): voidParameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the attribute to set |
$value | string | the value of the attribute to set |
Generated by Hazaar API Doc Generator on Wed, 07 Jan 2026 11:30:00 +0000