Download the PHP package gubler/twig-extensions without Composer
On this page you can find all versions of the php package gubler/twig-extensions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gubler/twig-extensions
More information about gubler/twig-extensions
Files in gubler/twig-extensions
Package twig-extensions
Short Description Twig extensions for internal projects
License MIT
Homepage https://github.com/gubler/twig-extensions
Informations about the package twig-extensions
TwigExtensions
This project provides several Twig extensions for internal projects.
Installation
The preferred method of installation is via Composer. Run the following command to install the package and add it as a requirement to your project's composer.json
:
Configuration
For Symfony, register it in your services.yaml
You can also use the MimeTypeToIconClass
library directly and inject it into your classes by registering it as a service:
Extensions
FileIconClass
This maps a mimetype to a FontAwesome file icon. This currently only supports the following filetypes:
- MS Word
- MS Excel
- MS PowerPoint
All other files return a generic file icon.
FlashMessages
This extension will iterate through the flashes of a given Session and convert them to Bootstrap 5 alerts.
This looks for the flash keys of success
, warning
, error
, and notice
.
Creating the flashes:
Rendering all flashes:
InstanceOf
This extension provides PHP's instanceof
type operator as a Twig test.
TableSortIcon
This filter allows you to pass the column name, the sorted column name, and sort direction and get back a FontAwesome sorting icon classes.
Contributing
Contributions are welcome! Please read CONTRIBUTING for details.
This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you are expected to uphold this code.
Copyright and License
The gubler/twig-extensions library is copyright © Daryl Gubler and licensed for use under the MIT License (MIT). Please see LICENSE for more information.