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.
No description
Sets auto-refresh mode.
Enables or disables an engine feature.
Checks if a feature is enabled.
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 61
__construct()
No description
at line 76
void
render(string $name, object|array $params = [], string|null $block = null)
Renders template to output.
at line 88
string
renderToString(string $name, object|array $params = [], string|null $block = null)
Renders template to string.
at line 100
Template
createTemplate(string $name, array $params = [], bool $clearCache = true)
Creates template object.
at line 118
string
compile(string $name)
Compiles template to PHP code.
at line 150
TemplateNode
parse(string $template)
Parses template to AST node.
at line 171
void
applyPasses(TemplateNode $node)
Calls node visitors.
at line 189
string
generate(TemplateNode $node, string $name)
Generates compiled PHP code.
at line 205
void
warmupCache(string $name)
Compiles template to cache.
at line 236
string
getCacheFile(string $name)
Returns the file path where compiled template will be cached.
at line 245
string
getTemplateClass(string $name)
Returns the PHP class name for compiled template.
at line 256
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 268
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 285
Engine
addFilter(string $name, callable $callback)
Registers run-time filter.
at line 299
Engine
addFilterLoader(callable $loader)
Registers filter loader.
at line 310
array
getFilters()
Returns all run-time filters.
at line 320
mixed
invokeFilter(string $name, array $args)
Call a run-time filter.
at line 348
array
getExtensions()
No description
at line 357
Engine
addFunction(string $name, callable $callback)
Registers run-time function.
at line 372
mixed
invokeFunction(string $name, array $args)
Call a run-time function.
at line 381
array
getFunctions()
No description
at line 390
Engine
addProvider(string $name, mixed $provider)
Adds new provider.
at line 405
array
getProviders()
Returns all providers.
at line 411
Engine
setPolicy(Policy|null $policy)
No description
at line 418
Policy|null
getPolicy(bool $effective = false)
No description
at line 426
Engine
setExceptionHandler(callable $handler)
No description
at line 433
Engine
setSandboxMode(bool $state = true)
No description
at line 440
Engine
setContentType(string $type)
No description
at line 450
Engine
setCacheDirectory(string|null $path)
Sets path to temporary directory.
at line 457
Engine
setTempDirectory(string|null $path)
No description
at line 466
Engine
setAutoRefresh(bool $state = true)
Sets auto-refresh mode.
at line 476
Engine
setFeature(string $feature, bool $state = true)
Enables or disables an engine feature.
at line 486
bool
hasFeature(string $feature)
Checks if a feature is enabled.
at line 495
Engine
setStrictTypes(bool $state = true)
Enables declare(strict_types=1) in templates.
at line 501
Engine
setStrictParsing(bool $state = true)
No description
at line 507
bool
isStrictParsing()
No description
at line 516
Engine
setLocale(string|null $locale)
Sets the locale. It uses the same identifiers as the PHP intl extension.
at line 526
string|null
getLocale()
No description
at line 539
Loader
getLoader()
No description
at line 545
Engine
enablePhpLinter(string|null $phpBinary)
No description
at line 555
Engine
setSyntax(string $syntax)
Sets default Latte syntax. Available options: 'single', 'double', 'off'
at line 608
__get(string $name)
No description