{"id":19327692,"url":"https://github.com/antidot-framework/twig-template-renderer","last_synced_at":"2025-04-22T21:30:30.248Z","repository":{"id":46040778,"uuid":"270259760","full_name":"antidot-framework/twig-template-renderer","owner":"antidot-framework","description":"Twig template engine for Antidot framework","archived":false,"fork":false,"pushed_at":"2021-11-19T03:27:49.000Z","size":25,"stargazers_count":2,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"1.x.x","last_synced_at":"2025-04-02T04:03:43.486Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antidot-framework.png","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","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"kpicaza"}},"created_at":"2020-06-07T09:44:17.000Z","updated_at":"2022-03-12T05:01:14.000Z","dependencies_parsed_at":"2022-08-02T18:15:40.375Z","dependency_job_id":null,"html_url":"https://github.com/antidot-framework/twig-template-renderer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antidot-framework%2Ftwig-template-renderer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antidot-framework%2Ftwig-template-renderer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antidot-framework%2Ftwig-template-renderer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antidot-framework%2Ftwig-template-renderer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antidot-framework","download_url":"https://codeload.github.com/antidot-framework/twig-template-renderer/tar.gz/refs/heads/1.x.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250328083,"owners_count":21412554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T02:18:10.535Z","updated_at":"2025-04-22T21:30:29.980Z","avatar_url":"https://github.com/antidot-framework.png","language":"PHP","funding_links":["https://github.com/sponsors/kpicaza"],"categories":[],"sub_categories":[],"readme":"# Antidot Framework Twig Template Renderer\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n[![Coverage Status][ico-scrutinizer]][link-scrutinizer]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nTwig Template Renderer for Antidot Framework\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require antidot-fw/twig-template-renderer\n```\n\n### Antidot framework\n\nIt will work out of the box, the only thing you need is to inject the TemplateRenderer interface in your request handler constructor\n\n### As standalone component\n\nSee factory classes at `src/Container`.\n\n## Config\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\n$config = [\n    'template' =\u003e [\n        'debug' =\u003e false,\n        'file_extension' =\u003e 'twig',\n        'charset' =\u003e 'utf-8',\n        'template_path' =\u003e 'templates',\n        'cache' =\u003e 'var/cache/twig',\n        'auto_reload' =\u003e false,\n        'autoescape' =\u003e 'html',\n        'strict_variables' =\u003e true,\n        'globals' =\u003e [\n            // 'name' =\u003e 'value',\n        ],\n        'extensions' =\u003e [\n            // EtensionClassName::class,\n        ],\n        'filters' =\u003e [\n            // 'name' =\u003e PHPCallableClass::class,\n            // 'some_function' =\u003e 'php_some_function,\n        ],\n        'functions' =\u003e [\n            // 'name' =\u003e PHPCallableClass::class,\n            // 'some_function' =\u003e 'php_some_function,\n        ],\n    ],\n];\n```\n\n## Usage\n\nSee full [Twig documentation](https://twig.symfony.com/doc/3.x/) for more detail.\n\n### In a request handler\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nuse Antidot\\Render\\TemplateRenderer;\nuse Laminas\\Diactoros\\Response\\HtmlResponse;\nuse Psr\\Http\\Server\\RequestHandlerInterface;\nuse Psr\\Http\\Message\\ServerRequestInterface;\nuse Psr\\Http\\Message\\ResponseInterface;\n\nclass SomeHandler implements RequestHandlerInterface\n{\n    private TemplateRenderer $template;\n\n    public function __construct(TemplateRenderer $template) \n    {\n        $this-\u003etemplate = $template;\n    }\n\n    public function handle(ServerRequestInterface $request) : ResponseInterface\n    {\n        return new HtmlResponse(\n            $this-\u003etemplate-\u003erender('index.html', [\n                'name' =\u003e 'Koldo ;-D',\n            ])\n        );\n    }\n}\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email kpicaza@example.com instead of using the issue tracker.\n\n## Credits\n\n- [kpicaza][link-author]\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/antidot-fw/twig-template-renderer.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://scrutinizer-ci.com/g/antidot-framework/twig-template-renderer/badges/coverage.png?b=master\n[ico-scrutinizer]: https://scrutinizer-ci.com/g/antidot-framework/twig-template-renderer/badges/quality-score.png?b=master\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/antidot-fw/twig-template-renderer.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/antidot-fw/twig-template-renderer.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/antidot-fw/twig-template-renderer\n[link-travis]: https://travis-ci.org/antidot-fw/twig-template-renderer\n[link-scrutinizer]: https://scrutinizer-ci.com/g/antidot-fw/twig-template-renderer/code-structure\n[link-downloads]: https://packagist.org/packages/antidot-fw/twig-template-renderer\n[link-author]: https://github.com/kpicaza\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantidot-framework%2Ftwig-template-renderer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantidot-framework%2Ftwig-template-renderer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantidot-framework%2Ftwig-template-renderer/lists"}