class Engine

Templating engine Latte.

Constants

VERSION

VERSION_ID

CONTENT_HTML

Content types

CONTENT_XHTML

Content types

CONTENT_XML

Content types

CONTENT_JS

Content types

CONTENT_CSS

Content types

CONTENT_ICAL

Content types

CONTENT_TEXT

Content types

Properties

callable[] $onCompile
internal $probe

Methods

__construct()

No description

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

Renders template to output.

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

Renders template to string.

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

Creates template object.

string
compile(string $name)

Compiles template to PHP code.

void
warmupCache(string $name)

Compiles template to cache.

string
getCacheFile(string $name)

No description

string
getTemplateClass(string $name)

No description

addFilter(string|null $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.

addMacro(string $name, Macro $macro)

Adds new macro.

addFunction(string $name, callable $callback)

Registers run-time function.

mixed
invokeFunction(string $name, array $args)

Call a run-time function.

addProvider(string $name, mixed $value)

Adds new provider.

array
getProviders()

Returns all providers.

setPolicy(Policy|null $policy)

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.

getParser()

No description

getCompiler()

No description

setLoader(Loader $loader)

No description

getLoader()

No description

Details

at line 76
__construct()

No description

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

Renders template to output.

Parameters

string $name
object|array $params
string $block

Return Value

void

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

Renders template to string.

Parameters

string $name
object|array $params
string $block

Return Value

string

at line 122
Template createTemplate(string $name, array $params = [])

Creates template object.

Parameters

string $name
array $params

Return Value

Template

at line 136
string compile(string $name)

Compiles template to PHP code.

Parameters

string $name

Return Value

string

at line 175
void warmupCache(string $name)

Compiles template to cache.

Parameters

string $name

Return Value

void

Exceptions

LogicException

at line 261
string getCacheFile(string $name)

No description

Parameters

string $name

Return Value

string

at line 271
string getTemplateClass(string $name)

No description

Parameters

string $name

Return Value

string

at line 282
Engine addFilter(string|null $name, callable $callback)

Registers run-time filter.

Parameters

string|null $name
callable $callback

Return Value

Engine

at line 296
Engine addFilterLoader(callable $callback)

Registers filter loader.

Parameters

callable $callback

Return Value

Engine

at line 311
array getFilters()

Returns all run-time filters.

Return Value

array

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

Call a run-time filter.

Parameters

string $name
array $args

Return Value

mixed

at line 332
Engine addMacro(string $name, Macro $macro)

Adds new macro.

Parameters

string $name
Macro $macro

Return Value

Engine

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

Registers run-time function.

Parameters

string $name
callable $callback

Return Value

Engine

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

Call a run-time function.

Parameters

string $name
array $args

Return Value

mixed

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

Adds new provider.

Parameters

string $name
mixed $value

Return Value

Engine

at line 389
array getProviders()

Returns all providers.

Return Value

array

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

No description

Parameters

Policy|null $policy

Return Value

Engine

at line 404
Engine setExceptionHandler(callable $callback)

No description

Parameters

callable $callback

Return Value

Engine

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

No description

Parameters

bool $on

Return Value

Engine

at line 420
Engine setContentType(string $type)

No description

Parameters

string $type

Return Value

Engine

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

Sets path to temporary directory.

Parameters

string|null $path

Return Value

Engine

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

Sets auto-refresh mode.

Parameters

bool $on

Return Value

Engine

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

Enables declare(strict_types=1) in templates.

Parameters

bool $on

Return Value

Engine

at line 460
Parser getParser()

No description

Return Value

Parser

at line 469
Compiler getCompiler()

No description

Return Value

Compiler

at line 481
Engine setLoader(Loader $loader)

No description

Parameters

Loader $loader

Return Value

Engine

at line 488
Loader getLoader()

No description

Return Value

Loader

Traits

Better OOP experience.