Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/JulienRAVIA/awesome-twig

A curated list of amazingly awesome Twig extensions, snippets and tutorials
https://github.com/JulienRAVIA/awesome-twig

List: awesome-twig

awesome awesome-list awesome-lists awesome-php framework-php frameworks template-engine template-language templating templating-engine templating-language twig twig-extension twig-filter

Last synced: 16 days ago
JSON representation

A curated list of amazingly awesome Twig extensions, snippets and tutorials

Awesome Lists containing this project

README

        

## Awesome Twig [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)

[](https://twig.symfony.com)

> A curated list of snippets, tutorials, extensions for [Twig](https://twig.symfony.com) created by [Fabien Potencier](http://fabien.potencier.org) and PHP frameworks using Twig

You might also like [awesome-php](https://github.com/ziadoz/awesome-php).

*Please read the [contribution guidelines](contributing.md) before contributing.*

## Twig

- [Official Website](https://twig.symfony.com)
- [Issues](https://github.com/twigphp/Twig/issues)
- [Github](https://github.com/twigphp/Twig)
- [Getting Started Guide and Installation Instructions](https://twig.symfony.com/doc/2.x/intro.html)
- [Documentation](https://twig.symfony.com/doc/2.x/)
- [API Documentation](https://twig.symfony.com/api/2.x/index.html)
- [CheatSheet](https://github.com/okeeffed/cheat-sheets/blob/master/twig-cheat-sheet.md)
- [Composer](https://github.com/composer/) - Download Composer to use Twig easily.
- [Packagist](https://packagist.org/?q=twig&p=0) - Search on Packagist for Twig

### Cheatsheets
1. [Drupal Twig](https://www.drupal.org/docs/8/modules/twig-tweak/cheat-sheet-8x-2x)
2. [Timber Twig](https://timber.github.io/docs/guides/cheatsheet/)
3. [Craft Twig](http://shared.focus.build/craft-cheat-sheet/)
4. https://github.com/andreia/awesome-twig - A collection of useful Twig snippets.
5. https://github.com/okeeffed/cheat-sheets/blob/master/twig-cheat-sheet.md
6. http://willthemoor.github.io/Twig-Cheat-Sheet/
7. https://issuu.com/idcf-france/docs/twig-cheatsheet
8. https://www.cheatography.com/ryguydg/cheat-sheets/symfony-and-twig/
9. https://i.pinimg.com/originals/9b/7c/f0/9b7cf0ed69f91af8bdbf3d55ec5f893e.jpg

### CMS & frameworks using Twig
#### [Packagist for Frameworks](https://packagist.org/?q=twig%20framework&p=0) | [Packagist for CMS](https://packagist.org/?q=twig%20cms&p=0)

- [Symfony](http://symfony.com/doc/current/templating.html) - PHP framework created by Fabien Potencier, also creator of Twig
- [Silex](https://silex.symfony.com/doc/2.0/providers/twig.html) - PHP micro-framework based on Symfony also created by Fabien Potencier
- [ezPublish](https://ez.no/fr) - open source enterprise PHP content management system
- [Themosis](https://framework.themosis.com/docs/master/twig/) - A WordPress framework
- [Drupal8](https://www.drupal.org/docs/8/theming/twig) - Popular PHP CMS
- [Timber](https://www.upstatement.com/timber/) - Templating system for Wordpress
- [OctoberCMS](https://octobercms.com/docs/markup/templating) - PHP CMS based on Laravel
- [CraftCMS](https://github.com/craftcms/docs/blob/v3/en/twig-primer.md) - Focused content management for web professionals
- [phpBb](https://www.phpbb.com) - Free and Open Source Forum Software

There's also a lot of frameworks & cms created by community using twig. There is also many packages integration for other frameworks such as [Laravel](https://laravel.com), [Slim](https://www.slimframework.com), [Yii Framework](https://www.yiiframework.com), [CodeIgniter](https://codeigniter.com), [CakePHP](https://cakephp.org), etc.

#### Stack Overflow

- You might use the following tags: `twig`, `templating`, `twig` + `php`.
- [Ask a new question](http://stackoverflow.com/questions/ask?tags=twig)
- [Find questions tagged `twig`](http://stackoverflow.com/questions/tagged/twig)

### Extensions
#### [Packagist](https://packagist.org/?q=twig%20extension&p=0)

- [Paginator Twig Extension](https://github.com/morozgrafix/PaginatorTwigExtension) - Twig extension to help generate simple paginations in Twig templates.
- [Truncate Text](https://github.com/dzango/TwigTruncateExtension) - A custom twig extension to truncate text while preserving HTML tags.
- [HTML Compress](https://github.com/nochso/html-compress-twig) - Twig extension for compressing HTML and inline CSS/JS using WyriHaximus/HtmlCompress
- [Breakpoints](https://github.com/ajgarlag/AjglBreakpointTwigExtension) - Twig extension to set breakpoints
- [PHP Functions](https://github.com/umpirsky/twig-php-function) - This extension allows you to call (almost) any PHP function from your Twig templates.
- [Var Type Checker](https://github.com/trapvincenzo/var-type-check) - Simple var type checker for Twig
- [core23/twig-extensions](https://github.com/core23/twig-extensions) - Bunch of awesome twig extensions by [core23](https://github.com/core23)
- [twigphp/twig-extensions](https://github.com/twigphp/Twig-extensions) - Bunch of awesome official twig extensions
- [jasny/twig-extensions](https://github.com/jasny/twig-extensions) - Bunch of awesome twig extensions by [jasny](https://github.com/jasny)
- [kzykhys/twig-extensions](https://github.com/kzykhys/TwigExtensions) - Bunch of awesome twig extensions by [kzykhys](https://github.com/kzykhys)
- [vudaltsov-legacy/twig-extensions](https://github.com/vudaltsov-legacy/twig-extensions) - Bunch of awesome twig extensions by [kzykhys](https://github.com/kzykhys)
- [JMB-Technology-Limited/twig-extensions](https://github.com/JMB-Technology-Limited/Twig-Extensions) - Bunch of awesome twig extensions by [JMB-Technology-Limited](https://github.com/JMB-Technology-Limited)
- [SortByField](https://github.com/victorhaggqvist/Twig-sort-by-field) - A Twig Extension filter to sort an array of entries (objects or arrays) by an entry field.
- [Assetic](https://github.com/kriswallsmith/assetic#twig) - Twig extension of PHP assets manager
- [Asset Version](https://github.com/ivoba/twig-asset-version-extension) - Render versioned asset filenames in twig.
- [Laravel DebugBar](https://github.com/barryvdh/laravel-debugbar#twig-integration) - Twig extensions for the Laravel library LaravelDebugBar
- [PHP DebugBar](https://github.com/bearlikelion/twig-debugbar) - A Twig extension to provide access to [PHP Debug Bar](https://github.com/maximebf/php-debugbar)'s rendering functions.
- [Twi18n](https://github.com/jhogervorst/Twi18n) - Powerful Twig translation extension using PHP's gettext.
- [Cache](https://github.com/twigphp/twig-cache-extension) - Cache fragments of templates directly within Twig.
- [Markdown](https://github.com/aptoma/twig-markdown) - Twig extension to work with Markdown content
- [Markdown²](https://github.com/jralph/Twig-Markdown) - A simple twig markdown extension.
- [Defer Block Rendering](https://github.com/rybakit/twig-deferred-extension) - An extension for Twig that allows to defer block rendering
- [GetText Extractor](https://packagist.org/packages/umpirsky/twig-gettext-extractor) - friendly tool which extracts translations from twig templates.
- [Twig Lambda](https://github.com/dpolac/twig-lambda) - Lambda expressions for Twig and filters that make use of them
- [EmailObfuscator](https://github.com/Propaganistas/Email-Obfuscator#twig) - A text filter for automatic email obfuscation using the well-established Javascript and a CSS fallback:
- [Configurable i18n](https://github.com/jaimeperez/twig-configurable-i18n) - extension allowing you to customize which functions to use for translations.
- [Webpack](https://github.com/fullpipe/twig-webpack-extension) - Inject your webpack entry points into twig templates with easy.
- [Country](https://github.com/alaczi/twig-country-extension) - Twig country filter extension for twig
- [MobileDetect](https://github.com/bes89/mobiledetect-twig-extension) - MobileDetect-integration for Twig
- [emberlabs/Gravatar](https://github.com/emberlabs/gravatarlib#twig-integration) - easy gravatar twig integration by [emberlabs](https://github.com/emberlabs)
- [ry167Gravatar²](https://github.com/ry167/twig-gravatar) - An extension for Twig that provides simple filters for Gravatar by [ry167](https://github.com/ry167).
- [HTML Helpers](https://github.com/njh/twig-html-helpers) - Rails style view helpers for HTML tags in PHP Twig
- [QRCode](https://github.com/priotas/twig-qrcode-extension) - A Twig extension for embedding inline QR codes in Twig templates
- [Whitespace Collapse](https://github.com/MatTheCat/twig-whitespace-collapse-extension) - Whitespace collapse extension for Twig
- [Const Resolver](https://github.com/silentroach/twig-const-resolver) - Simple Twig plugin to resolve constant on template cache build
- [OrdinalNumber](https://github.com/fvozar/twig-ordinal-number-filter) - A Twig Extension filter to format number into ordinal form (1st, 2nd, etc.).
- [Apply Filters](https://github.com/marcj/twig-apply_filter-bundle) - This filter allows you to call dynamic filters in twig.
- [Strftime](https://github.com/teraone/twig-strftime-extension) - use strftime function in twig
- [SVG](https://github.com/manuelodelain/svg-twig-extension) - Add inline svg with Twig$
- [csg4twig](https://github.com/mbaynton/csv4twig) - A CSV escaping filter for the Twig templating engine.
- [Share](https://github.com/neemzy/share-extension) - Twig extension providing social share links
- [Parsedown (Markdown Parser)](https://github.com/parsedown/twig) - Parsedown's Markdown parser Extension
- [Linewrap](https://github.com/TechWilk/twig-linewrap) - Twig filter to wrap lines exceeding the specified length.
- [Inflection](https://github.com/davedevelopment/twig-inflection) - Filters (singularize and pluralize)
- [Array Group](https://github.com/cviebrock/twig-group) - Twig filter that splits an array into a given number of groups (unlike batch, which splits the array based on items per group)
- [Geshi](https://github.com/neilime/geshi-twig-extension) - Twig extension to work with Geshi - Generic Syntax Highlighter rendering
- [Natural Join](https://github.com/cviebrock/twig-natural-join) - Twig filter that joins an array using a different separator for the last element
- [Gist](https://github.com/dflydev/dflydev-github-gist-twig-extension) - A simple Twig extension for embedding GitHub Gist snippets into Twig templates.
- [Resource](https://github.com/phpconcur/twig-resource) - Resource handling for Twig templates
- [LocaleName](https://github.com/alaczi/twig-locale-name-extension) - Twig locale name filter extension for twig
- [Safe Date](https://github.com/vivait/twig-safe-date) - A safe date function in twig that will not set null dates to today.
- [Useful HTML Extension](https://github.com/jswhetstone/twig-extension) - Some useful Twig functions for context-relevant class rendering.
- [CSRF Helpers](https://github.com/schnittstabil/csrf-twig-helpers) - CSRF (Cross-Site Request Forgery) protection helpers for the Twig templating engine.
- [Linkify](https://github.com/manuelodelain/linkify-twig-extension) - Twig extension for Linkify - converts URLs and email addresses into HTML links
- [HTMLStrip](https://github.com/PurpleBooth/twig-htmlstrip) - Filter for Twig to convert HTML into Text
- [List Loop](https://github.com/aaronadal/twig-list-loop) - A different way to display lists, grids and tables in Twig: the list loop.
- [faker](https://github.com/alanablett/twig-faker) - Integration of PHP [faker](https://github.com/fzaninotto/Faker) library with the twig templating system.
- [Twital](https://github.com/goetas/twital) - It's a plugin for Twig that adds some sugar syntax, which makes its templates similar to PHPTal or VueJS.
- [Relative Path](https://github.com/diasfs/twig-relative-path) - A Twig extension that allows to include and extends templates using relative paths.

### Snippets

- [HTML Select Macro](https://gist.github.com/goreilly/5756bc2b5ef1ef8e33e3)
- [Pagination](https://gist.github.com/SimonSimCity/4594748)

### Code editors & IDE extensions

Check this [page](https://twig.symfony.com/doc/2.x/templates.html#ides-integration) to discover the multiples extensions for IDE & code editors created by community
- CraftTwig - Plugin for [Sublime Text](https://packagecontrol.io/packages/Craft-Twig), [Atom](https://atom.io/packages/craft-twig) adding CraftCMS Twig snippets
- [October Twig Highlighter](https://packagecontrol.io/packages/October%20Twig%20Highlighter) - This package adds syntax definitions for the OctoberCMS Twig engine
- [Atom Twig Packages](https://atom.io/packages/search?q=twig) - Shortcut to Twig packages list for [Atom](https://atom.io)
- [VSCode Twig Packages](https://marketplace.visualstudio.com/search?term=twig&target=VSCode&category=All%20categories&sortBy=Relevance)
- Shortcut to Twig packages list for [Visual Studio Code](https://code.visualstudio.com)

### Tutorials

_Coming soon_

### Tools

- [TwigExpress](https://github.com/kaliop/twig-express) - Getting started with Twig templates thanks to a simple PHP script
- [TwigFiddle](https://twigfiddle.com) - Develop, run, store and access Twig code online
- [Twigcs](https://github.com/allocine/twigcs) - Check for violations on Twig coding standard
- [Read more](https://timber.github.io/docs/getting-started/twig-tools/)

### Javascript Alternatives

- [twing](https://github.com/NightlyCommit/twing) - JS implementation of the Twig Templating Language (compatible with Twig 1, 2 and 3)
- [twig.js](https://github.com/twigjs/twig.js) - JS implementation of the Twig Templating Language
- [swig](https://github.com/paularmstrong/swig) - JS implementation of the Twig Templating Language²
- [Nunjucks](http://mozilla.github.io/nunjucks/) - JS implementation of the Twig Templating Language³
- [Template7](http://idangero.us/template7/)
- [Underscore.js](http://underscorejs.org)
- [EJS](http://ejs.co/)
- [mustache.js](https://github.com/janl/mustache.js)
- [Handlebars](http://handlebarsjs.com)
- [Javascript Templates](https://blueimp.github.io/JavaScript-Templates/)

### Python Alternatives

- [Jinja2](http://jinja.pocoo.org/docs/2.10/) - Templating system for Python [Django Framework](https://www.djangoproject.com)

---

## License

[![CC0](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/)

To the extent possible under law, [Julien RAVIA](https://github.com/JulienRAVIA) has waived all copyright and related or neighboring rights to this work.