class Engine

Templating engine Latte.

Constants

Version

VersionId

deprecated VERSION

deprecated VERSION_ID

deprecated CONTENT_HTML

deprecated CONTENT_XML

deprecated CONTENT_JS

deprecated CONTENT_CSS

deprecated CONTENT_ICAL

deprecated CONTENT_TEXT

Methods

__construct()

No description

void
render(string $name, object|array $params = [], string|null $block = null)

Renders template to output.

string
renderToString(string $name, object|array $params = [], string|null $block = null)

Renders template to string.

createTemplate(string $name, array $params = [], $clearCache = true)

Creates template object.

string
compile(string $name)

Compiles template to PHP code.

parse(string $template)

Parses template to AST node.

void
applyPasses(TemplateNode $node)

Calls node visitors.

string
generate(TemplateNode $node, string $name)

Generates compiled PHP code.

void
warmupCache(string $name)

Compiles template to cache.

string
getCacheFile(string $name)

No description

string
getTemplateClass(string $name)

No description

array
getCacheKey()

Values that affect the results of compilation and the name of the cache file.

array
getCacheSignature(string $name)

Values that check the expiration of the compiled template.

addFilter(string $name, callable $callback)

Registers run-time filter.

addFilterLoader(callable $loader)

Registers filter loader.

array
getFilters()

Returns all run-time filters.

mixed
invokeFilter(string $name, array $args)

Call a run-time filter.

addExtension(Extension $extension)

Adds new extension.

array
getExtensions()

No description

addFunction(string $name, callable $callback)

Registers run-time function.

mixed
invokeFunction(string $name, array $args)

Call a run-time function.

array
getFunctions()

No description

addProvider(string $name, mixed $provider)

Adds new provider.

array
getProviders()

Returns all providers.

setPolicy(Policy|null $policy)

No description

Policy|null
getPolicy(bool $effective = false)

No description

setExceptionHandler(callable $handler)

No description

setSandboxMode(bool $state = true)

No description

setContentType(string $type)

No description

setTempDirectory(string|null $path)

Sets path to temporary directory.

setAutoRefresh(bool $state = true)

Sets auto-refresh mode.

setStrictTypes(bool $state = true)

Enables declare(strict_types=1) in templates.

setStrictParsing(bool $state = true)

No description

bool
isStrictParsing()

No description

setLocale(string|null $locale)

Sets the locale. It uses the same identifiers as the PHP intl extension.

string|null
getLocale()

No description

setLoader(Loader $loader)

No description

getLoader()

No description

enablePhpLinter(string|null $phpBinary)

No description

__get(string $name)

No description

Details

at line 56
__construct()

No description

at line 70
void render(string $name, object|array $params = [], string|null $block = null)

Renders template to output.

Parameters

string $name
object|array $params
string|null $block

Return Value

void

at line 82
string renderToString(string $name, object|array $params = [], string|null $block = null)

Renders template to string.

Parameters

string $name
object|array $params
string|null $block

Return Value

string

at line 94
Template createTemplate(string $name, array $params = [], $clearCache = true)

Creates template object.

Parameters

string $name
array $params
$clearCache

Return Value

Template

at line 116
string compile(string $name)

Compiles template to PHP code.

Parameters

string $name

Return Value

string

at line 148
TemplateNode parse(string $template)

Parses template to AST node.

Parameters

string $template

Return Value

TemplateNode

at line 168
void applyPasses(TemplateNode $node)

Calls node visitors.

Parameters

TemplateNode $node

Return Value

void

at line 186
string generate(TemplateNode $node, string $name)

Generates compiled PHP code.

Parameters

TemplateNode $node
string $name

Return Value

string

at line 202
void warmupCache(string $name)

Compiles template to cache.

Parameters

string $name

Return Value

void

Exceptions

LogicException

at line 302
string getCacheFile(string $name)

No description

Parameters

string $name

Return Value

string

at line 311
string getTemplateClass(string $name)

No description

Parameters

string $name

Return Value

string

at line 328
protected array getCacheKey()

Values that affect the results of compilation and the name of the cache file.

Return Value

array

at line 348
protected array getCacheSignature(string $name)

Values that check the expiration of the compiled template.

Parameters

string $name

Return Value

array

at line 364
Engine addFilter(string $name, callable $callback)

Registers run-time filter.

Parameters

string $name
callable $callback

Return Value

Engine

at line 378
Engine addFilterLoader(callable $loader)

Registers filter loader.

Parameters

callable $loader

Return Value

Engine

at line 389
array getFilters()

Returns all run-time filters.

Return Value

array

at line 399
mixed invokeFilter(string $name, array $args)

Call a run-time filter.

Parameters

string $name
array $args

Return Value

mixed

at line 408
Engine addExtension(Extension $extension)

Adds new extension.

Parameters

Extension $extension

Return Value

Engine

at line 427
array getExtensions()

No description

Return Value

array

at line 436
Engine addFunction(string $name, callable $callback)

Registers run-time function.

Parameters

string $name
callable $callback

Return Value

Engine

at line 451
mixed invokeFunction(string $name, array $args)

Call a run-time function.

Parameters

string $name
array $args

Return Value

mixed

at line 460
array getFunctions()

No description

Return Value

array

at line 469
Engine addProvider(string $name, mixed $provider)

Adds new provider.

Parameters

string $name
mixed $provider

Return Value

Engine

at line 484
array getProviders()

Returns all providers.

Return Value

array

at line 490
Engine setPolicy(Policy|null $policy)

No description

Parameters

Policy|null $policy

Return Value

Engine

at line 497
Policy|null getPolicy(bool $effective = false)

No description

Parameters

bool $effective

Return Value

Policy|null

at line 505
Engine setExceptionHandler(callable $handler)

No description

Parameters

callable $handler

Return Value

Engine

at line 512
Engine setSandboxMode(bool $state = true)

No description

Parameters

bool $state

Return Value

Engine

at line 519
Engine setContentType(string $type)

No description

Parameters

string $type

Return Value

Engine

at line 529
Engine setTempDirectory(string|null $path)

Sets path to temporary directory.

Parameters

string|null $path

Return Value

Engine

at line 539
Engine setAutoRefresh(bool $state = true)

Sets auto-refresh mode.

Parameters

bool $state

Return Value

Engine

at line 549
Engine setStrictTypes(bool $state = true)

Enables declare(strict_types=1) in templates.

Parameters

bool $state

Return Value

Engine

at line 556
Engine setStrictParsing(bool $state = true)

No description

Parameters

bool $state

Return Value

Engine

at line 563
bool isStrictParsing()

No description

Return Value

bool

at line 572
Engine setLocale(string|null $locale)

Sets the locale. It uses the same identifiers as the PHP intl extension.

Parameters

string|null $locale

Return Value

Engine

at line 582
string|null getLocale()

No description

Return Value

string|null

at line 588
Engine setLoader(Loader $loader)

No description

Parameters

Loader $loader

Return Value

Engine

at line 595
Loader getLoader()

No description

Return Value

Loader

at line 601
Engine enablePhpLinter(string|null $phpBinary)

No description

Parameters

string|null $phpBinary

Return Value

Engine

at line 643
__get(string $name)

No description

Parameters

string $name