Engine
class Engine
Templating engine Latte.
Constants
| Version |
|
| VersionId |
|
| deprecated VERSION |
|
| deprecated VERSION_ID |
|
| CONTENT_HTML |
|
| CONTENT_XML |
|
| CONTENT_JS |
|
| CONTENT_CSS |
|
| CONTENT_ICAL |
|
| 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.
No description
Returns all run-time filters.
Calls a run-time filter.
No description
Registers run-time function.
Calls a run-time function.
Returns all run-time functions.
Adds new provider.
Returns all providers.
No description
Sets a handler called when an exception occurs during template rendering.
No description
No description
Sets path to cache directory.
Sets auto-refresh mode.
Enables or disables an engine feature.
Checks if a feature is enabled.
Sets the locale. It uses the same identifiers as the PHP intl extension.
No description
Validates compiled PHP code using the given PHP binary. Pass null to disable.
Sets default Latte syntax. Available options: 'single', 'double', 'off'
No description
Details
at line 68
__construct()
No description
at line 82
void
render(string $name, object|array $params = [], string|null $block = null)
Renders template to output.
at line 94
string
renderToString(string $name, object|array $params = [], string|null $block = null)
Renders template to string.
at line 106
Template
createTemplate(string $name, array $params = [], bool $clearCache = true)
Creates template object.
at line 124
string
compile(string $name)
Compiles template to PHP code.
at line 156
TemplateNode
parse(string $template)
Parses template to AST node.
at line 178
void
applyPasses(TemplateNode $node)
Runs all registered compiler passes over the AST.
at line 196
string
generate(TemplateNode $node, string $name)
Generates compiled PHP code.
at line 208
void
warmupCache(string $name)
Compiles template to cache.
at line 240
string
getCacheFile(string $name)
Returns the file path where compiled template will be cached.
at line 249
string
getTemplateClass(string $name)
Returns the PHP class name for compiled template.
at line 260
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 273
protected array
generateConfigurationSignature()
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 290
Engine
addFilter(string $name, callable $callback)
Registers run-time filter.
at line 301
Engine
addFilterLoader(callable $loader)
No description
at line 314
array
getFilters()
Returns all run-time filters.
at line 324
mixed
invokeFilter(string $name, array $args)
Calls a run-time filter.
at line 352
array
getExtensions()
No description
at line 361
Engine
addFunction(string $name, callable $callback)
Registers run-time function.
at line 376
mixed
invokeFunction(string $name, array $args)
Calls a run-time function.
at line 386
array
getFunctions()
Returns all run-time functions.
at line 395
Engine
addProvider(string $name, mixed $provider)
Adds new provider.
at line 410
array
getProviders()
Returns all providers.
at line 416
Engine
setPolicy(Policy|null $policy)
No description
at line 423
Policy|null
getPolicy(bool $effective = false)
No description
at line 434
Engine
setExceptionHandler(callable $handler)
Sets a handler called when an exception occurs during template rendering.
at line 441
Engine
setSandboxMode(bool $state = true)
No description
at line 448
Engine
setContentType(string $type)
No description
at line 458
Engine
setCacheDirectory(string|null $path)
Sets path to cache directory.
at line 466
Engine
setTempDirectory(string|null $path)
deprecated
deprecated
No description
at line 475
Engine
setAutoRefresh(bool $state = true)
Sets auto-refresh mode.
at line 485
Engine
setFeature(Feature $feature, bool $state = true)
Enables or disables an engine feature.
at line 495
bool
hasFeature(Feature $feature)
Checks if a feature is enabled.
at line 505
Engine
setStrictTypes(bool $state = true)
deprecated
deprecated
Enables declare(strict_types=1) in templates.
at line 512
Engine
setStrictParsing(bool $state = true)
deprecated
deprecated
No description
at line 519
bool
isStrictParsing()
deprecated
deprecated
No description
at line 528
Engine
setLocale(string|null $locale)
Sets the locale. It uses the same identifiers as the PHP intl extension.
at line 538
string|null
getLocale()
No description
at line 551
Loader
getLoader()
No description
at line 560
Engine
enablePhpLinter(string|null $phpBinary)
Validates compiled PHP code using the given PHP binary. Pass null to disable.
at line 570
Engine
setSyntax(string $syntax)
Sets default Latte syntax. Available options: 'single', 'double', 'off'
at line 578
Engine
setMigrationWarnings(bool $state = true)
deprecated
deprecated
No description
at line 584
protected void
addDefaultExtensions()
No description