Skip to main content

Configuration

Publish the config file with:

php artisan vendor:publish --tag=expression-engine-config

This creates config/expression-engine.php. The container-bound Engine singleton reads its settings from here. If you construct an Engine yourself, you pass the same array shape to its constructor — commonly new Engine([...config('expression-engine'), 'strict' => true]) to override one key.

delimiters

'delimiters' => [
'open' => '{{',
'close' => '}}',
],

The opening and closing markers resolve() and resolveArray() look for when scanning a template string. Change them if {{ }} collides with another templating layer (Blade, a frontend framework) in the same strings.

'delimiters' => ['open' => '[[', 'close' => ']]'],

With custom delimiters configured, the default {{ }} is no longer recognised and is left untouched in the output.

Only affects resolve() / resolveArray(). evaluate() takes a raw expression with no delimiters.

strict

'strict' => false,

When false (the default), a path that can't be resolved from the context evaluates to null. When true, it throws UnresolvedPathException — except where ?. is used, which always allows a missing base to resolve to null.

See Context and paths → strict mode.

cache

'cache' => [
'ast' => true,
'results' => true,
'driver' => env('EXPRESSION_ENGINE_CACHE_DRIVER', 'array'),
'ttl' => 3600,
],
  • ast — when true, a parsed expression is kept on the engine instance and reused if the same expression string is evaluated again during the instance's lifetime. Turn off only if you are evaluating an unbounded number of distinct expressions in one long-lived process and want to cap memory.
  • results — when true, within a single resolve() / resolveArray() / run() call, an expression evaluated against identical context is computed once and reused for the rest of that call.

Note: driver and ttl are present in the published config but are not currently read by the engine — AST and result caching are in-memory and scoped as described above. Treat these two keys as reserved.

env_whitelist

'env_whitelist' => [],

The keys the built-in env() function is permitted to read. This is default-deny: env() throws EvaluatorException for any key not in this list, so an empty array (the default) disables env() entirely.

Add only non-sensitive keys that expression authors legitimately need:

'env_whitelist' => ['APP_ENV', 'APP_URL'],

Never add credentials, API keys, or secrets — expression authors on a low-code surface are not necessarily trusted with those.