Integrates Gravatar into Twig templating engine
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.editorconfig
.gitattributes
.gitignore
.php_cs
.scrutinizer.yml
.styleci.yml
.travis.yml
CHANGELOG.md
LICENSE
README.md
composer.json
phpunit.xml.dist

README.md

Gravatar Twig Integration

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

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.