piestar/dough

The Dough Templating Language

Maintainers

Details

github.com/Piestar/dough

Source

Issues

Installs: 7 644

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Type:project

1.0.1 2018-12-20 20:33 UTC

This package is auto-updated.

Last update: 2024-04-21 19:45:11 UTC


README

Build Status Total Downloads Latest Version License

Dough is a tiny templating language that understands two constructs:

  • {{ some_variable }} Normal variables (will be HTML-escaped on output)

  • {!! some_variable !!} Raw variables (will not be HTML-escaped when output)

It also allows for arrays in its data: {{ pie.name }}

We use this for user-exposed tokens in a mail merge, where we wouldn't want the user to have access to a more complex templating language with a larger surface area to secure.

Be aware that this package does not currently protect against JavaScript or malicious HTML injection.

Examples

$mixed = DoughMixer::mix("pie is {{ pie }}"   , ['pie' => '<good>']); // "pie is &lt;good&rt;"
$mixed = DoughMixer::mix("pie is {!! pie !!}" , ['pie' => '<good>']); // "pie is <good>"
$mixed = DoughMixer::mix("Eat {{ pie.name }}!", 
                                 ['pie' => ['name' => 'Apple Pie']]); // "Eat Apple Pie!"