{"id":18224026,"url":"https://github.com/xp-lang/php-template-literals","last_synced_at":"2026-07-10T22:31:29.676Z","repository":{"id":260820580,"uuid":"882432308","full_name":"xp-lang/php-template-literals","owner":"xp-lang","description":"Template literals for PHP","archived":false,"fork":false,"pushed_at":"2024-11-02T21:25:43.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-24T06:15:27.129Z","etag":null,"topics":["compiler-plugin","php7","php8","template-literals","xp-compiler","xp-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xp-lang.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-02T19:03:54.000Z","updated_at":"2024-11-02T21:25:46.000Z","dependencies_parsed_at":"2024-11-02T20:20:18.674Z","dependency_job_id":"f71f7bdf-1fa0-4b1d-9864-71dd4b82c818","html_url":"https://github.com/xp-lang/php-template-literals","commit_stats":null,"previous_names":["xp-lang/php-template-literals"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xp-lang/php-template-literals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-lang%2Fphp-template-literals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-lang%2Fphp-template-literals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-lang%2Fphp-template-literals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-lang%2Fphp-template-literals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xp-lang","download_url":"https://codeload.github.com/xp-lang/php-template-literals/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-lang%2Fphp-template-literals/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35345661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-10T02:00:06.465Z","response_time":60,"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":["compiler-plugin","php7","php8","template-literals","xp-compiler","xp-framework"],"created_at":"2024-11-04T01:05:55.458Z","updated_at":"2026-07-10T22:31:29.653Z","avatar_url":"https://github.com/xp-lang.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Template literals for PHP\n=========================\n\n[![Build status on GitHub](https://github.com/xp-lang/php-template-literals/workflows/Tests/badge.svg)](https://github.com/xp-lang/php-template-literals/actions)\n[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)\n[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)\n[![Requires PHP 7.4+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_4plus.svg)](http://php.net/)\n[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)\n[![Latest Stable Version](https://poser.pugx.org/xp-lang/php-template-literals/version.svg)](https://packagpatternt.org/packages/xp-lang/php-template-literals)\n\nPlugin for the [XP Compiler](https://github.com/xp-framework/compiler/) which reimagines [JS template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) for PHP.\n\nExample\n-------\nThe following outputs `https://thekid.de/?a\u0026amp;b` - the ampersand is encoded correctly:\n\n```php\n$html= function($strings, ... $arguments) {\n  $r= '';\n  foreach ($strings as $i =\u003e $string) {\n    $r.= $string.htmlspecialchars($arguments[$i] ?? '');\n  }\n  return $r;\n};\n\n$link= 'https://thekid.de/?a\u0026b';\necho $html`This is a \u003ca href=\"${$link}\"\u003elink\u003c/a\u003e.`;\n```\n\nThe compiler transforms the syntax with expressions embedded in `${}` into the following:\n\n```php\necho $html(['This is a ', '.'], $link);\n```\n\nInstallation\n------------\nAfter installing the XP Compiler into your project, also include this plugin.\n\n```bash\n$ composer require xp-framework/compiler\n# ...\n\n$ composer require xp-lang/php-template-literals\n# ...\n```\n\nNo further action is required.\n\nSee also\n--------\n* https://peps.python.org/pep-0750/ - Template Strings\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-lang%2Fphp-template-literals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxp-lang%2Fphp-template-literals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-lang%2Fphp-template-literals/lists"}