class Engine

Templating engine Latte.

Constants

VERSION

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

Methods

__construct()

No description

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

Renders template to output.

string
renderToString(string $name, 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.

array
getFilters()

Returns all run-time filters.

mixed
invokeFilter(string $name, array $args)

Call a run-time filter.

addMacro(string $name, IMacro $macro)

Adds new macro.

addFunction(string $name, callable $callback)

Registers run-time function.

addProvider(string $name, $value)

Adds new provider.

array
getProviders()

Returns all providers.

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(ILoader $loader)

No description

getLoader()

No description

Details

at line 66
__construct()

No description

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

Renders template to output.

Parameters

string $name
array $params
string $block

Return Value

void

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

Renders template to string.

Parameters

string $name
array $params
string $block

Return Value

string

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

Creates template object.

Parameters

string $name
array $params

Return Value

Template

at line 110
string compile(string $name)

Compiles template to PHP code.

Parameters

string $name

Return Value

string

at line 154
void warmupCache(string $name)

Compiles template to cache.

Parameters

string $name

Return Value

void

Exceptions

LogicException

at line 225
string getCacheFile(string $name)

No description

Parameters

string $name

Return Value

string

at line 235
string getTemplateClass(string $name)

No description

Parameters

string $name

Return Value

string

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

Registers run-time filter.

Parameters

string|null $name
callable $callback

Return Value

Engine

at line 257
array getFilters()

Returns all run-time filters.

Return Value

array

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

Call a run-time filter.

Parameters

string $name
array $args

Return Value

mixed

at line 277
Engine addMacro(string $name, IMacro $macro)

Adds new macro.

Parameters

string $name
IMacro $macro

Return Value

Engine

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

Registers run-time function.

Parameters

string $name
callable $callback

Return Value

Engine

at line 299
Engine addProvider(string $name, $value)

Adds new provider.

Parameters

string $name
$value

Return Value

Engine

at line 309
array getProviders()

Returns all providers.

Return Value

array

at line 316
Engine setContentType(string $type)

No description

Parameters

string $type

Return Value

Engine

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

Sets path to temporary directory.

Parameters

string|null $path

Return Value

Engine

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

Sets auto-refresh mode.

Parameters

bool $on

Return Value

Engine

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

Enables declare(strict_types=1) in templates.

Parameters

bool $on

Return Value

Engine

at line 356
Parser getParser()

No description

Return Value

Parser

at line 365
Compiler getCompiler()

No description

Return Value

Compiler

at line 377
Engine setLoader(ILoader $loader)

No description

Parameters

ILoader $loader

Return Value

Engine

at line 384
ILoader getLoader()

No description

Return Value

ILoader

Traits

Better OOP experience.