Template

Introduction

The template class is a simple service that parses a string view.

Basic Usage

Include the Anomaly\Streams\Platform\Support\Template class in your code to get started.

render

The render method renders the string template with the given payload.

$template = app(Anomaly\Streams\Platform\Support\Template::class);

$template->parse($template, array $payload = []);
$template = app(Anomaly\Streams\Platform\Support\Template::class);

$template->parse('Hello {{ user().first_name }} {{ user().last_name }}!');
// Hello Ryan Thompson!

make

The make method makes a template file and returns it's path.

$template = app(Anomaly\Streams\Platform\Support\Template::class);

$template->make('Hello {{ user().first_name }} {{ user().last_name }}!');
// storage::9e0c01033b8fbd9297aaa81b91ffdc8d