carter-digital / twig-extensions
Carter Digital's twig extensions pack
3.0.2
2025-02-11 06:59 UTC
Requires
- php: >=8.2
- twig/twig: 3.14.*
- vlucas/phpdotenv: >=3
Requires (Dev)
- phpunit/phpunit: 10
README
Custom Twig functions used for our websites since 2020.
Installation
Should be easily installed using composer
composer require carter-digital/twig-extensions
Extensions
PHP function based
- getenv() - implementation of PHP/Craft's getenv()
- isEnglish() - implementation of PHP's preg_match to find alphanumeric latin symbols in a string
- manifestFile() - cache busting helper function
- md5() - implemenation of PHP's md5()
- pathinfo() - implementation of PHP's pathinfo()
- uniqueId() - implementation of PHP's rand()
CraftCMS based
- Filters
- text|t - returns the same text
- Functions
- svg('filepath') - returns file_get_contents() of the filepath
Credits:
Heavily based on jasny/twig-extensions package.