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

pyrrah/gravatar-bundle

Symfony bundle that simplifies Gravatar integration, providing services and Twig helpers to generate avatar URLs from email addresses with configurable size, default image, rating, and secure hashing. Lightweight and easy to configure.

View on GitHub
Deep Wiki
Context7

The simple way to use Gravatar API for Symfony 7 and Symfony 8

Frequently asked questions about Gravatar Bundle
Does pyrrah/gravatar-bundle work with Laravel?
No. It is a Symfony bundle that relies on bundle registration in the kernel, DI autowiring, and a Twig extension, none of which exist in a Laravel application. The actual feature is small: lowercase and trim an email, md5 the result, and interpolate it into https://www.gravatar.com/avatar/{hash} with s, d and r query parameters. Reimplementing that in Laravel takes roughly 20 to 40 lines plus a Blade component, and avoids pulling Symfony HttpKernel, DependencyInjection and the Twig bridge into your stack.
How do I install pyrrah/gravatar-bundle?
Run composer require pyrrah/gravatar-bundle, then register PyrrahGravatarBundle in your Symfony bundle configuration and add the gravatar config block for default image, size, rating and secure mode. The service and Twig helper become available immediately through the container. If you are on Laravel, there is no bundle registration step to follow, which is the first sign the package is a stack mismatch rather than an install problem.
How do I generate a Gravatar URL from an email address in Laravel?
Build a small service that lowercases and trims the email, takes md5 of the clean value, and formats https://www.gravatar.com/avatar/{hash}?s={size}&d={default}&r={rating}. Expose it through a Blade component or helper so templates stay consistent, and cache the resulting URL per user rather than recomputing it on every render. This mirrors exactly what the Symfony bundle does internally, without the framework coupling.
Which Symfony versions does version 1.6.0 support?
Version 1.6.0 adds Symfony 8 support but drops Symfony 6.4 through 7.3, so projects on those versions must pin to the v1.5.x branch. It is a maintenance release only, with no new capability, and the Symfony 8 requirement also raises the PHP floor. That means adopters must track the newest Symfony minor or carry a branch pin, which is a real cost signal even though it does not affect Laravel projects directly.
How do I configure the default avatar image, size and rating?
The bundle exposes configuration for the d parameter (default image such as mp, identicon, retro or a URL), the s parameter (size in pixels, valid range 1 to 2048) and the r parameter (g, pg, r or x). Twig helper calls can override those defaults per use. If you reimplement in Laravel, mirror the same keys in config/gravatar.php and resolve per-tenant overrides from there.
How do I use the Gravatar service outside Twig templates?
The bundle registers a DI service you can autowire into a controller or any other service, then call to get an avatar URL from an email address and optional size, default and rating. This is useful for API responses, mail templates or schema markup where Twig is not involved. In Laravel the equivalent is a singleton bound in a service provider and injected wherever needed.
Is it a privacy or GDPR problem to send MD5 email hashes to Gravatar?
Gravatar is operated by Automattic, and an MD5 of an email is pseudonymous but trivially reversible for any known address, so treat it as a third-party transfer of user data. This is a product and compliance decision independent of which library you use, and the bundle itself performs no network calls. If you need to avoid the transfer, proxy and cache avatars server-side, use a self-hosted default image, or generate local initials or identicons instead.
How do I use Gravatar avatars with a Content Security Policy?
If browsers hit gravatar.com directly, your img-src directive must allow https://www.gravatar.com and https://secure.gravatar.com. The alternative is to proxy avatar fetches through your own endpoint and cache them, so img-src can stay limited to self and you gain control over cache headers and regional availability. Decide this early because it also determines whether you need server-side HTTP handling at all.
How do I test a Gravatar integration without hitting the network?
Test the URL builder as a pure function: pass a known email with mixed case and surrounding spaces, assert the output hash matches the md5 of the normalized address, and assert the query parameters for size, default and rating. There is no I/O in the bundle, so no HTTP faking is required for the generator itself. Only add network-level tests if you build a server-side avatar proxy or cache.
Is pyrrah/gravatar-bundle actively maintained, and what are the alternatives?
The maintainer is active, with version 1.6.0 released recently to add Symfony 8 support, but the project has around 11 stars, zero dependents and a single maintainer, so the bus factor is one. Technical risk is low because the library does no I/O, deserialization or network calls, but its support posture optimizes for the newest Symfony minor rather than conservative adopters. For Laravel the sensible alternatives are a small in-house URL generator, a locally generated initials or identicon service, or a thin interface over multiple providers such as Gravatar and Libravatar if you need fallbacks.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core