This Twig extension generates user avatar using name initials letter inside Twig templates. Based on yohang88/letter-avatar
avatar
Via Composer
$ composer require olivers/twig-avatar-extension
Use the avatar
function to generate user avatar.
{% set userCompleteName = 'Peter Jackson' %}
<img src="{{ avatar(userCompleteName, '', 64) }}" />
This example would output avatar with two initials letter like PJ
, as Peter Jackson
is the providen user name.