Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antidot-framework/twig-template-renderer
Twig template engine for Antidot framework
https://github.com/antidot-framework/twig-template-renderer
Last synced: 3 days ago
JSON representation
Twig template engine for Antidot framework
- Host: GitHub
- URL: https://github.com/antidot-framework/twig-template-renderer
- Owner: antidot-framework
- License: mit
- Created: 2020-06-07T09:44:17.000Z (over 4 years ago)
- Default Branch: 1.x.x
- Last Pushed: 2021-11-19T03:27:49.000Z (almost 3 years ago)
- Last Synced: 2024-05-21T07:10:36.312Z (6 months ago)
- Language: PHP
- Size: 24.4 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Antidot Framework Twig Template Renderer
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
[![Total Downloads][ico-downloads]][link-downloads]Twig Template Renderer for Antidot Framework
## Install
Via Composer
``` bash
$ composer require antidot-fw/twig-template-renderer
```### Antidot framework
It will work out of the box, the only thing you need is to inject the TemplateRenderer interface in your request handler constructor
### As standalone component
See factory classes at `src/Container`.
## Config
```php
[
'debug' => false,
'file_extension' => 'twig',
'charset' => 'utf-8',
'template_path' => 'templates',
'cache' => 'var/cache/twig',
'auto_reload' => false,
'autoescape' => 'html',
'strict_variables' => true,
'globals' => [
// 'name' => 'value',
],
'extensions' => [
// EtensionClassName::class,
],
'filters' => [
// 'name' => PHPCallableClass::class,
// 'some_function' => 'php_some_function,
],
'functions' => [
// 'name' => PHPCallableClass::class,
// 'some_function' => 'php_some_function,
],
],
];
```## Usage
See full [Twig documentation](https://twig.symfony.com/doc/3.x/) for more detail.
### In a request handler
```php
template = $template;
}public function handle(ServerRequestInterface $request) : ResponseInterface
{
return new HtmlResponse(
$this->template->render('index.html', [
'name' => 'Koldo ;-D',
])
);
}
}
```## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Testing
``` bash
$ composer test
```## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.
## Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [kpicaza][link-author]
- [All Contributors][link-contributors]## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/antidot-fw/twig-template-renderer.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://scrutinizer-ci.com/g/antidot-framework/twig-template-renderer/badges/coverage.png?b=master
[ico-scrutinizer]: https://scrutinizer-ci.com/g/antidot-framework/twig-template-renderer/badges/quality-score.png?b=master
[ico-code-quality]: https://img.shields.io/scrutinizer/g/antidot-fw/twig-template-renderer.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/antidot-fw/twig-template-renderer.svg?style=flat-square[link-packagist]: https://packagist.org/packages/antidot-fw/twig-template-renderer
[link-travis]: https://travis-ci.org/antidot-fw/twig-template-renderer
[link-scrutinizer]: https://scrutinizer-ci.com/g/antidot-fw/twig-template-renderer/code-structure
[link-downloads]: https://packagist.org/packages/antidot-fw/twig-template-renderer
[link-author]: https://github.com/kpicaza
[link-contributors]: ../../contributors