Integrates Gravatar into Twig templating engine.
Via Composer
$ composer require gravatarphp/twig-integration
use Gravatar\Gravatar;
use Gravatar\Twig\GravatarExtension;
$extension = new GravatarExtension(new Gravatar());
$environment->addExtension($extension);
Use it in a twig template:
<a href="{{ '[email protected]'|gravatar_avatar }}">Avatar</a>
<a href="{{ '[email protected]'|gravatar_profile }}">Profile</a>
<a href="{{ '[email protected]'|gravatar_vcard }}">vCard</a>
<a href="{{ '[email protected]'|gravatar_qrCode }}">QR Code</a>
Options can be provided as first filter parameter, for example:
<a href="{{ '[email protected]'|gravatar_avatar({d: 'retro'}) }}">Avatar</a>
All options can be found on Gravatar's documentation.
$ composer test
The MIT License (MIT). Please see License File for more information.