{"id":16119968,"url":"https://github.com/uuf6429/expression-language-tplstring","last_synced_at":"2026-05-02T04:36:17.305Z","repository":{"id":45752717,"uuid":"514388468","full_name":"uuf6429/expression-language-tplstring","owner":"uuf6429","description":"🪡 Template Strings support for Symfony Expression Language","archived":false,"fork":false,"pushed_at":"2022-12-24T04:57:58.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-21T23:09:17.854Z","etag":null,"topics":["expression-language","php","symfony","syntax","template-strings","uuf6429"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uuf6429.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-15T19:51:07.000Z","updated_at":"2023-12-17T21:26:42.000Z","dependencies_parsed_at":"2022-07-30T12:48:13.584Z","dependency_job_id":null,"html_url":"https://github.com/uuf6429/expression-language-tplstring","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/uuf6429/expression-language-tplstring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uuf6429%2Fexpression-language-tplstring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uuf6429%2Fexpression-language-tplstring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uuf6429%2Fexpression-language-tplstring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uuf6429%2Fexpression-language-tplstring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uuf6429","download_url":"https://codeload.github.com/uuf6429/expression-language-tplstring/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uuf6429%2Fexpression-language-tplstring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32523427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T01:12:54.858Z","status":"online","status_checked_at":"2026-05-02T02:00:05.923Z","response_time":132,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expression-language","php","symfony","syntax","template-strings","uuf6429"],"created_at":"2024-10-09T20:55:42.098Z","updated_at":"2026-05-02T04:36:17.269Z","avatar_url":"https://github.com/uuf6429.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- TODO WIP --\u003e\n\n# 🪡 Template Strings\nfor Symfony Expression Language (4-6)\n\n[![CI](https://github.com/uuf6429/expression-language-tplstring/actions/workflows/ci.yml/badge.svg)](https://github.com/uuf6429/expression-language-tplstring/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/uuf6429/expression-language-tplstring/branch/main/graph/badge.svg)](https://codecov.io/gh/uuf6429/expression-language-tplstring)\n[![Minimum PHP Version](https://img.shields.io/badge/php-%5E7%20%7C%20%5E8-8892BF.svg)](https://php.net/)\n[![License](https://poser.pugx.org/uuf6429/expression-language-tplstring/license)](https://github.com/uuf6429/expression-language-tplstring/blob/main/LICENSE)\n[![Latest Stable Version](https://poser.pugx.org/uuf6429/expression-language-tplstring/version)](https://packagist.org/packages/uuf6429/expression-language-tplstring)\n[![Latest Unstable Version](https://poser.pugx.org/uuf6429/expression-language-tplstring/v/unstable)](https://packagist.org/packages/uuf6429/expression-language-tplstring)\n\n\u003c!-- TODO WIP --\u003e\n\n\u003e **What looks like a dot, a cross and a wave, and does the same thing?**\n\u003e\n\u003e It's the concatenation operator, of course!\n\u003e\n\u003e PHP uses a dot/period (`.`), many languages including javascript use `+`,\n\u003e whereas [Symfony Expression Language](https://github.com/symfony/expression-language) uses the tilde (`~`).\n\nThis library provides a translation layer on top of Expression Language that converts template strings in ES6 format* to\nvalid expression.\nWhile an updated Expression Language subclass is provided for convenience, you don't have to use it, and you can use the\nprovided trait instead.\n\n*\\* only ES6 string interpolation (with any expressions and nesting) is supported; f.e. tagged templates are not.*\n\n## 🔌 Installation\n\nAs always, the recommended and easiest way to install this library is through [Composer](https://getcomposer.org/):\n\n```bash\ncomposer require \"uuf6429/expression-language-tplstring\"\n```\n\n## 🚀 Usage\n\nIf you do not plan on extending Symfony Expression Language class, you can use the provided drop-in:\n\n```php\n$el = new \\uuf6429\\ExpressionLanguage\\ExpressionLanguageWithTplStr();\n$el-\u003eevaluate('`hello ${name}!`', ['name'=\u003e'mars']); // =\u003e hello mars!\n```\n\nOtherwise, you can subclass the desired Expression Language class and `use` the provided trait:\n```php\nclass MyEL extends \\uuf6429\\ExpressionLanguage\\ExpressionLanguageWithArrowFunc\n{\n    use \\uuf6429\\ExpressionLanguage\\TemplateStringTranslatorTrait;\n    \n    public function compile($expression, array $names = [])\n    {\n        if (!$expression instanceof \\Symfony\\Component\\ExpressionLanguage\\ParsedExpression) {\n            $expression = $this-\u003etranslateTplToEl($expression);\n        }\n\n        return parent::compile($expression, $names);\n    }\n\n    public function evaluate($expression, array $values = [])\n    {\n        if (!$expression instanceof \\Symfony\\Component\\ExpressionLanguage\\ParsedExpression) {\n            $expression = $this-\u003etranslateTplToEl($expression);\n        }\n\n        return parent::evaluate($expression, $values);\n    }\n}\n\n$el = new MyEL();\n$el-\u003eevaluate(\n    'users.map((user) -\u003e { `hello ${user.name}!` }).join(` `)',\n    [\n        'users' =\u003e new \\Illuminate\\Support\\Collection([\n            (object)['name' =\u003e 'John', 'surname' =\u003e 'Doe'],\n            (object)['name' =\u003e 'Jane', 'surname' =\u003e 'Roe'],\n        ])\n    ]\n); // =\u003e hello John! hello Jane!\n```\n\n\u003c!-- TODO WIP --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuuf6429%2Fexpression-language-tplstring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuuf6429%2Fexpression-language-tplstring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuuf6429%2Fexpression-language-tplstring/lists"}