Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Gravatar Bundle

Gravatar Bundle Laravel Package

mluex/gravatar-bundle

A Symfony bundle that integrates Gravatar avatars into your application. It provides Twig helpers and services to generate Gravatar URLs from email addresses, with support for default images, size, rating, and secure HTTPS URLs, making it easy to display user avatars consistently.

View on GitHub
Deep Wiki
Context7

Simple wrapper to gravatar API for Symfony 5 - Forked from ornicar/gravatar-bundle

Frequently asked questions about Gravatar Bundle
Can I install mluex/gravatar-bundle in a Laravel application?
No, not as a normal dependency. mluex/gravatar-bundle is a Symfony bundle, not a Laravel package: it registers a gravatar service through Symfony's DI container and exposes a Twig helper, and Laravel has no bundle or extension mechanism to load it. Composer will also fight you because the bundle requires symfony/framework-bundle 5.x while Laravel 10 and 11 ship Symfony 6.x and 7.x components. Treat it as a reference implementation and copy the URL-building logic instead.
Does mluex/gravatar-bundle support Laravel 10 or Laravel 11?
No. The bundle targets Symfony 4 and 5 with PHP 7.2+, and there is no release with PHP 8.2 or 8.3 CI signal and no Symfony 6 or 7 support. Laravel 10 and 11 already pull in Symfony 6.x and 7.x components, so requiring symfony/framework-bundle ^5.0 creates a hard conflict. There is also no Laravel service provider, facade or config file in the package.
What does mluex/gravatar-bundle actually do?
It wraps Gravatar URL generation in a Symfony service plus a Twig helper class, GravatarBundle\Templating\Helper\GravatarHelper. It md5-hashes a normalized email address and builds https://www.gravatar.com/avatar/{hash} URLs with configurable size, default image, rating and force-default parameters. It supports both HTTP and HTTPS and includes an optional cache-warming command for profile lookups. The URL generation path itself performs no network I/O.
How do I generate a Gravatar URL in Laravel without this package?
Normalize the address with strtolower(trim($email)), hash it with md5() for the classic endpoint or hash('sha256', ...) for Gravatar's newer SHA-256 endpoint, then build https://www.gravatar.com/avatar/{hash} with the s, d, r and f query parameters. Escape the d value with rawurlencode() when it is a full image URL, otherwise the query string breaks. Roughly 40 lines in an App\Support\Gravatar class, bound in AppServiceProvider and backed by config/gravatar.php, replaces the bundle entirely.
How do I build a Blade component or directive for Gravatars in Laravel?
Bind a small Gravatar class in AppServiceProvider and expose a Blade component such as <x-gravatar :email="$user->email" /> that renders an img tag with width, height, alt and loading="lazy". You can also register a @gravatar directive or add a HasAvatar trait with a getAvatarUrlAttribute accessor so $user->avatar_url works in Eloquent. Blade components are the Laravel equivalent of the bundle's Twig helper; do not pull in Symfony Templating just to mimic it.
How do I set the default image, size, and rating in a Gravatar URL?
Gravatar accepts s for size in pixels (1 to 2048), d for the default image (mp, identicon, monsterid, wavatar, retro, 404, or a URL-encoded image URL), r for the rating ceiling (g, pg, r or x) and f=y to force the default image. In Laravel, keep these values in config/gravatar.php and read them with config('gravatar.size') so they can differ per environment. Always rawurlencode the d value when it is a full URL, or the query string will be malformed.
Is mluex/gravatar-bundle still maintained and safe for production?
The last release was 2020-03-21, the repository has around 2 stars and no dependents, and it is a single-maintainer fork of ornicar/gravatar-bundle. The risk is not primarily security, because Gravatar's URL contract is stable and the package does no I/O beyond optional profile lookups; the risk is obsolescence, a single bus factor and an unpatchable transitive dependency chain pinned to Symfony 5. For production use, vendor the two behaviours you actually need rather than the bundle.
How do I test Gravatar URL generation in a Laravel app?
URL generation is a pure function, so test it by asserting the exact string for a known email, size, default image and rating. Freeze config inside the test with config(['gravatar.size' => 80]) and assert the hash matches md5(strtolower(trim($email))). No HTTP client or Guzzle fake is required unless you add profile lookups; if you do, use Http::fake() to keep the suite offline.
What are the privacy concerns of sending email hashes to gravatar.com?
Gravatar works by sending a hash of the user's email address to gravatar.com, which means a third-party request, and a potential tracking surface, on every render unless you cache or proxy the images. Under GDPR-style reviews, document the transfer, prefer d=mp or a local avatar fallback for users without a Gravatar, and consider caching the resolved URLs. If your privacy posture forbids the third-party call entirely, store avatars locally and skip Gravatar.
Are there Laravel-native alternatives to mluex/gravatar-bundle?
creativeorange/gravatar is the commonly cited Laravel package, but it is also low-activity, so apply the same due diligence on PHP and Laravel version support before adopting it. In most Laravel codebases the cleanest option is an in-house App\Support\Gravatar class of about 40 lines, plus a Blade component and a config/gravatar.php file, which removes the dependency completely. That approach also lets you choose md5 versus sha256 hashing and control the default-image and privacy policy yourself.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect