olivers / twig-avatar-extension
This Twig extension generates user avatar using name initials letter inside Twig templates
Installs: 1 451
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- twig/twig: >=2.4
- yohang88/letter-avatar: >=2.0.1
This package is auto-updated.
Last update: 2025-03-08 04:10:55 UTC
README
This Twig extension generates user avatar using name initials letter inside Twig templates. Based on yohang88/letter-avatar
avatar
Install
Via Composer
$ composer require olivers/twig-avatar-extension
Showing avatar based on user complete name
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.