PHPackages                             prgfx/fusion-template-literals - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. prgfx/fusion-template-literals

ActiveNeos-package[Templating &amp; Views](/categories/templating)

prgfx/fusion-template-literals
==============================

A fusion DSL providing a syntax similar to the javascript tagged template literals

0.3.0(6y ago)08GPL-3.0-or-laterPHP

Since Jan 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/PRGfx/Fusion-Template-Literals)[ Packagist](https://packagist.org/packages/prgfx/fusion-template-literals)[ RSS](/packages/prgfx-fusion-template-literals/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Prgfx.Fusion.TemplateLiterals
=============================

[](#prgfxfusiontemplateliterals)

A [Neos Fusion](https://github.com/neos/typoscript) DSL implementation based on tagged template literals in javascript.

```
composer require prgfx/fusion-template-literals

```

Usage
-----

[](#usage)

By default this package defines the DSL identifier `plain`, but you can alias it for more meaningful tags for your application.

```
p = Some.Example:Prototype {
    value = plain`Some text with ${I18n.translate('interpolated')} values`
}
```

This package comes with two implementations: an array-renderer (creating a fusion array-like object (e.g. `Neos.Fusion:Array` or `Neos.Fusion:Join` as per configuration)) and an eel-expression renderer.
The latter has the advantage that you may reference variables as `${this.variable}` as it would seem intuitive:

```
trackingId = ${Configuration.setting(...)}
snippet = inline`(w=> { w.qa=w.qa||[];w.qa.push('create', '${this.trackingId}');})(window);`
```

**However** this does not work well with multiline blocks as the eel expression does not properly output newlines. This would be fine for snippets like shown above with block mode `compress` (see below). (After all this package mainly targets such scenarios.)

Multiline blocks
----------------

[](#multiline-blocks)

Given a block-mode modifier in the first line (and nothing else in this line), multiline blocks may be interpreted differently. The block-mode modifier can be configured in `Prgfx.Fusion.TemplateLiterals.blockDelimiters` to your preferences. There are different multiline block-modes:

### default

[](#default)

only cut off surrounding empty lines, keeps the rest as is

```
value = plain`
    line 1
    line 2
`
// will not contain the first and last "empty" line
```

### block

[](#block)

will trim all indentation

```
value = plain`|
    line 1
        line 2
    line 3
`
// will return 'line 1\n    line 2\nline3'
```

### singleLine

[](#singleline)

will trim all indentation and join newlines with a single space.
double newlines will create a line break.

```
value = plain`>
    line 1
    line 2

    line 3
`
// 'line 1 line 2\nline3'
```

### compress

[](#compress)

compared to singleLine will remove *all* surrounding whitespace per line:

```
value = plain`>>
if (foo) {
    console.log(foo);
}
`
// 'if (foo) { console.log(foo); }'
```

Custom implementations
----------------------

[](#custom-implementations)

This package is implemented in a way that you can easily extend the `PlainTemplateLiterals` implementation and override the `generateCode` method. This method receives `stringParts: string[]` and `...expressions: string[]` just like the javascript equivalent.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2320d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b516f86c82d95d7527303175480844e74203b00e59f8c92ffcf6b08611a300c0?d=identicon)[mklatte](/maintainers/mklatte)

---

Top Contributors

[![PRGfx](https://avatars.githubusercontent.com/u/3868790?v=4)](https://github.com/PRGfx "PRGfx (11 commits)")

---

Tags

neos-fusionneoscms

### Embed Badge

![Health badge](/badges/prgfx-fusion-template-literals/health.svg)

```
[![Health](https://phpackages.com/badges/prgfx-fusion-template-literals/health.svg)](https://phpackages.com/packages/prgfx-fusion-template-literals)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
