gravatarphp / twig-integration
Integrates Gravatar into Twig templating engine
Fund package maintenance!
gmponos
sagikazarmark
Requires
- php: >=7.2
- gravatarphp/gravatar: ^2.0
- twig/twig: ^1.43 || ^2.13 || ^3.0
Requires (Dev)
- phpunit/phpunit: ^8.5.8 || ^9.2.0
This package is auto-updated.
Last update: 2024-11-29 04:00:33 UTC
README
Integrates Gravatar into Twig templating engine.
Install
Via Composer
$ composer require gravatarphp/twig-integration
Usage
use Gravatar\Gravatar; use Gravatar\Twig\GravatarExtension; $extension = new GravatarExtension(new Gravatar()); $environment->addExtension($extension);
Use it in a twig template:
<a href="{{ 'user@domain.com'|gravatar_avatar }}">Avatar</a> <a href="{{ 'user@domain.com'|gravatar_profile }}">Profile</a> <a href="{{ 'user@domain.com'|gravatar_vcard }}">vCard</a> <a href="{{ 'user@domain.com'|gravatar_qrCode }}">QR Code</a>
Options can be provided as first filter parameter, for example:
<a href="{{ 'user@domain.com'|gravatar_avatar({d: 'retro'}) }}">Avatar</a>
All options can be found on Gravatar's documentation.
Testing
$ composer test
Credits
License
The MIT License (MIT). Please see License File for more information.