An open API service indexing awesome lists of open source software.

https://github.com/mickaelandrieu/twig-skill

Twig templating engine integration into Jarvis micro framework
https://github.com/mickaelandrieu/twig-skill

Last synced: 7 months ago
JSON representation

Twig templating engine integration into Jarvis micro framework

Awesome Lists containing this project

README

          

# Twig integration in Jarvis micro framework

## Installation

you need to install it using composer and then be sure that this configuration
is available when Jarvis Application is started:

```php
[
'Jarvis\Skill\Twig\ContainerProvider',
],
'twig' => [
'templates_paths' => '/path/to/templates',
],
]);
```

Note that `templates_paths` is a required parameter. This skill changes default values for some options:

- `debug`: if not provided, this value take the value of Jarvis `debug` parameter.
- `auto_reload`: this is setted to `true` as default value in this skill.
- `strict_variables`: this option is also setted to `true` by default.

You can see complete options list on [Twig documentation](http://twig.sensiolabs.org/doc/api.html#environment-options).

```php
router->addRoute('get', '/', function ($jarvis) {
return $jarvis->twig->render('index.twig', ['world' => 'World']);
});

$response = $jarvis->analyze();

$response->send();
```