Documentation

WebLinkExtension extends AbstractExtension
in package

FinalYes

Twig extension for the Symfony WebLink component.

Tags
author

Kévin Dunglas dunglas@gmail.com

Table of Contents

Properties

$requestStack  : mixed

Methods

__construct()  : mixed
dnsPrefetch()  : string
Resolves a resource origin as early as possible.
getFilters()  : array<string|int, TwigFilter>
Returns a list of filters to add to the existing list.
getFunctions()  : array<string|int, TwigFunction>
Returns a list of functions to add to the existing list.
getNodeVisitors()  : array<string|int, NodeVisitorInterface>
Returns the node visitor instances to add to the existing list.
getOperators()  : array<string|int, array<string|int, mixed>>
Returns a list of operators to add to the existing list.
getTests()  : array<string|int, TwigTest>
Returns a list of tests to add to the existing list.
getTokenParsers()  : array<string|int, TokenParserInterface>
Returns the token parser instances to add to the existing list.
link()  : string
Adds a "Link" HTTP header.
preconnect()  : string
Initiates a early connection to a resource (DNS resolution, TCP handshake, TLS negotiation).
prefetch()  : string
Indicates to the client that it should prefetch this resource.
preload()  : string
Preloads a resource.
prerender()  : string
Indicates to the client that it should prerender this resource .

Properties

Methods

dnsPrefetch()

Resolves a resource origin as early as possible.

public dnsPrefetch(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$uri : string
$attributes : array<string|int, mixed> = []

The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")

Return values
string

The path of the asset

getOperators()

Returns a list of operators to add to the existing list.

public getOperators() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>>

First array of unary operators, second array of binary operators

Adds a "Link" HTTP header.

public link(string $uri, string $rel[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$uri : string
$rel : string

The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch")

$attributes : array<string|int, mixed> = []

The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")

Return values
string

The relation URI

preconnect()

Initiates a early connection to a resource (DNS resolution, TCP handshake, TLS negotiation).

public preconnect(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$uri : string
$attributes : array<string|int, mixed> = []

The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")

Return values
string

The path of the asset

prefetch()

Indicates to the client that it should prefetch this resource.

public prefetch(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$uri : string
$attributes : array<string|int, mixed> = []

The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")

Return values
string

The path of the asset

preload()

Preloads a resource.

public preload(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$uri : string
$attributes : array<string|int, mixed> = []

The attributes of this link (e.g. "['as' => true]", "['crossorigin' => 'use-credentials']")

Return values
string

The path of the asset

prerender()

Indicates to the client that it should prerender this resource .

public prerender(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$uri : string
$attributes : array<string|int, mixed> = []

The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")

Return values
string

The path of the asset


        
On this page

Search results