Download the PHP package parisek/twig-attribute without Composer
On this page you can find all versions of the php package parisek/twig-attribute. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download parisek/twig-attribute
More information about parisek/twig-attribute
Files in parisek/twig-attribute
Package twig-attribute
Short Description A Twig extension for adding attributes to an element
License GPL-2.0-or-later
Homepage https://github.com/parisek/twig-attribute
Informations about the package twig-attribute
Twig Attribute Extension
Twig is desperately missing wrapper function to handle HTML Attributes. I borrowed great Attribute class from Drupal. It collects, sanitizes, and renders HTML attributes in a nice way.
This package was created based on issue #2664570 - Move Attribute classes under Drupal\Component which created groundwork for using this class outside Drupal world. Unfortunately I had to copy code out because issue is still open. I hope issue will be merged soon, so I can switch to official component split off from Drupal core with proper attribution. Expected component should be available at https://github.com/drupal/core-attribute
Installation
Twig Attribute Extension can be easily installed using composer
composer require parisek/twig-attribute
Usage
To use in a symfony project register the extensions as a service.
Template
Examples were copied from official Drupal documentation.
Use Cases
All versions of twig-attribute with dependencies
drupal/core-utility Version ^10.0 || ^11.0
twig/twig Version ^2.4 || ^3.0