Download the PHP package uuf6429/expression-language-tplstring without Composer
On this page you can find all versions of the php package uuf6429/expression-language-tplstring. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download uuf6429/expression-language-tplstring
More information about uuf6429/expression-language-tplstring
Files in uuf6429/expression-language-tplstring
Package expression-language-tplstring
Short Description Template String support for Symfony Expression Language
License MIT
Homepage https://github.com/uuf6429/expressions-language-tplstring
Informations about the package expression-language-tplstring
🪡 Template Strings
for Symfony Expression Language (4-6)
What looks like a dot, a cross and a wave, and does the same thing?
It's the concatenation operator, of course!
PHP uses a dot/period (
.
), many languages including javascript use+
, whereas Symfony Expression Language uses the tilde (~
).
This library provides a translation layer on top of Expression Language that converts template strings in ES6 format* to valid expression. While an updated Expression Language subclass is provided for convenience, you don't have to use it, and you can use the provided trait instead.
* only ES6 string interpolation (with any expressions and nesting) is supported; f.e. tagged templates are not.
🔌 Installation
As always, the recommended and easiest way to install this library is through Composer:
🚀 Usage
If you do not plan on extending Symfony Expression Language class, you can use the provided drop-in:
Otherwise, you can subclass the desired Expression Language class and use
the provided trait: