class Engine

Templating engine Latte.

Constants

VERSION

VERSION_ID

deprecated CONTENT_HTML

deprecated CONTENT_XML

deprecated CONTENT_JS

deprecated CONTENT_CSS

deprecated CONTENT_ICAL

deprecated CONTENT_TEXT

Properties

internal $probe

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 = [])

Creates template object.

string
compile(string $name)

Compiles template to PHP code.

parse(string $source)

Parses template to AST node.

void
applyPasses(TemplateNode $node)

Calls node visitors.

string
generate(TemplateNode $node, string $name)

Generates template PHP code.

void
warmupCache(string $name)

Compiles template to cache.

string
getCacheFile(string $name)

No description

string
getTemplateClass(string $name)

No description

addFilter(string $name, callable $callback)

Registers run-time filter.

addFilterLoader(callable $callback)

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.

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 $value)

Adds new provider.

array
getProviders()

Returns all providers.

setPolicy(Policy|null $policy)

No description

Policy|null
getPolicy(bool $effective = false)

No description

setExceptionHandler(callable $callback)

No description

setSandboxMode(bool $on = true)

No description

setContentType(string $type)

No description

setTempDirectory(string|null $path)

Sets path to temporary directory.

setAutoRefresh(bool $on = true)

Sets auto-refresh mode.

setStrictTypes(bool $on = true)

Enables declare(strict_types=1) in templates.

setLoader(Loader $loader)

No description

getLoader()

No description

__get(string $name)

No description

Details

at line 54
__construct()

No description

at line 68
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 81
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 = [])

Creates template object.

Parameters

string $name
array $params

Return Value

Template

at line 119
string compile(string $name)

Compiles template to PHP code.

Parameters

string $name

Return Value

string

at line 147
TemplateNode parse(string $source)

Parses template to AST node.

Parameters

string $source

Return Value

TemplateNode

at line 167
void applyPasses(TemplateNode $node)

Calls node visitors.

Parameters

TemplateNode $node

Return Value

void

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

Generates template 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 308
string getCacheFile(string $name)

No description

Parameters

string $name

Return Value

string

at line 318
string getTemplateClass(string $name)

No description

Parameters

string $name

Return Value

string

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

Registers run-time filter.

Parameters

string $name
callable $callback

Return Value

Engine

at line 351
Engine addFilterLoader(callable $callback)

Registers filter loader.

Parameters

callable $callback

Return Value

Engine

at line 362
array getFilters()

Returns all run-time filters.

Return Value

array

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

Call a run-time filter.

Parameters

string $name
array $args

Return Value

mixed

at line 381
Engine addExtension(Extension $extension)

Adds new extension.

Parameters

Extension $extension

Return Value

Engine

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

Registers run-time function.

Parameters

string $name
callable $callback

Return Value

Engine

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

Call a run-time function.

Parameters

string $name
array $args

Return Value

mixed

at line 431
array getFunctions()

No description

Return Value

array

at line 440
Engine addProvider(string $name, mixed $value)

Adds new provider.

Parameters

string $name
mixed $value

Return Value

Engine

at line 455
array getProviders()

Returns all providers.

Return Value

array

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

No description

Parameters

Policy|null $policy

Return Value

Engine

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

No description

Parameters

bool $effective

Return Value

Policy|null

at line 476
Engine setExceptionHandler(callable $callback)

No description

Parameters

callable $callback

Return Value

Engine

at line 483
Engine setSandboxMode(bool $on = true)

No description

Parameters

bool $on

Return Value

Engine

at line 490
Engine setContentType(string $type)

No description

Parameters

string $type

Return Value

Engine

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

Sets path to temporary directory.

Parameters

string|null $path

Return Value

Engine

at line 510
Engine setAutoRefresh(bool $on = true)

Sets auto-refresh mode.

Parameters

bool $on

Return Value

Engine

at line 520
Engine setStrictTypes(bool $on = true)

Enables declare(strict_types=1) in templates.

Parameters

bool $on

Return Value

Engine

at line 527
Engine setLoader(Loader $loader)

No description

Parameters

Loader $loader

Return Value

Engine

at line 534
Loader getLoader()

No description

Return Value

Loader

at line 581
__get(string $name)

No description

Parameters

string $name

Traits

Better OOP experience.