Engine
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
No description
Renders template to output.
Renders template to string.
Creates template object.
Compiles template to PHP code.
Parses template to AST node.
Compiles template to cache.
Returns the file path where compiled template will be cached.
Returns the PHP class name for compiled template.
Generates unique hash for template based on current configuration.
Returns values that determine isolation for different configurations.
Registers filter loader.
Returns all run-time filters.
Call a run-time filter.
No description
Registers run-time function.
Call a run-time function.
No description
Adds new provider.
Returns all providers.
No description
No description
No description
No description
Sets path to temporary directory.
Sets auto-refresh mode.
Enables declare(strict_types=1) in templates.
No description
No description
Sets the locale. It uses the same identifiers as the PHP intl extension.
No description
No description
Sets default Latte syntax. Available options: 'single', 'double', 'off'
No description
Details
at line 58
__construct()
No description
at line 73
void
render(string $name, object|array $params = [], string|null $block = null)
Renders template to output.
at line 85
string
renderToString(string $name, object|array $params = [], string|null $block = null)
Renders template to string.
at line 97
Template
createTemplate(string $name, array $params = [], bool $clearCache = true)
Creates template object.
at line 115
string
compile(string $name)
Compiles template to PHP code.
at line 147
TemplateNode
parse(string $template)
Parses template to AST node.
at line 168
void
applyPasses(TemplateNode $node)
Calls node visitors.
at line 186
string
generate(TemplateNode $node, string $name)
Generates compiled PHP code.
at line 202
void
warmupCache(string $name)
Compiles template to cache.
at line 233
string
getCacheFile(string $name)
Returns the file path where compiled template will be cached.
at line 242
string
getTemplateClass(string $name)
Returns the PHP class name for compiled template.
at line 253
string
generateTemplateHash(string $name)
| internal |
Generates unique hash for template based on current configuration.
Used to create isolated cache files for different engine configurations.
at line 265
protected array
getCacheKey()
Returns values that determine isolation for different configurations.
When any of these values change, a new compiled template is created to avoid conflicts.
at line 283
Engine
addFilter(string $name, callable $callback)
Registers run-time filter.
at line 297
Engine
addFilterLoader(callable $loader)
Registers filter loader.
at line 308
array
getFilters()
Returns all run-time filters.
at line 318
mixed
invokeFilter(string $name, array $args)
Call a run-time filter.
at line 346
array
getExtensions()
No description
at line 355
Engine
addFunction(string $name, callable $callback)
Registers run-time function.
at line 370
mixed
invokeFunction(string $name, array $args)
Call a run-time function.
at line 379
array
getFunctions()
No description
at line 388
Engine
addProvider(string $name, mixed $provider)
Adds new provider.
at line 403
array
getProviders()
Returns all providers.
at line 409
Engine
setPolicy(Policy|null $policy)
No description
at line 416
Policy|null
getPolicy(bool $effective = false)
No description
at line 424
Engine
setExceptionHandler(callable $handler)
No description
at line 431
Engine
setSandboxMode(bool $state = true)
No description
at line 438
Engine
setContentType(string $type)
No description
at line 448
Engine
setTempDirectory(string|null $path)
Sets path to temporary directory.
at line 458
Engine
setAutoRefresh(bool $state = true)
Sets auto-refresh mode.
at line 468
Engine
setStrictTypes(bool $state = true)
Enables declare(strict_types=1) in templates.
at line 475
Engine
setStrictParsing(bool $state = true)
No description
at line 482
bool
isStrictParsing()
No description
at line 491
Engine
setLocale(string|null $locale)
Sets the locale. It uses the same identifiers as the PHP intl extension.
at line 501
string|null
getLocale()
No description
at line 514
Loader
getLoader()
No description
at line 520
Engine
enablePhpLinter(string|null $phpBinary)
No description
at line 530
Engine
setSyntax(string $syntax)
Sets default Latte syntax. Available options: 'single', 'double', 'off'
at line 583
__get(string $name)
No description