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 Laravel Package

creativeorange/gravatar

Laravel package for generating Gravatar image URLs and profile links from an email address. Supports configurable sizes, default images, ratings, and hashed emails with a simple facade/helper API for Blade views and PHP code.

View on GitHub
Deep Wiki
Context7

creativeorange/gravatar is a lightweight Laravel package for generating Gravatar avatar URLs from an email address. It provides a clean, expressive API for building avatar URLs with configurable size, default image, rating, and file extension options—no manual hashing or URL construction required.

The package integrates smoothly with Laravel via a facade and helper, making it easy to drop avatars into views, Blade templates, or user profiles. Whether you need a simple fallback avatar or fine-grained control over image settings, this package keeps it concise and readable.

  • Simple Gravatar::get($email) API for instant avatar URLs
  • Configurable size, default image, rating, and extension
  • Built-in Laravel facade and global helper support
  • Automatic MD5 hashing of email addresses
  • Publishable config for project-wide defaults
Frequently asked questions about Gravatar
How do I install creativeorange/gravatar in a Laravel app?
Run composer require creativeorange/gravatar in your Laravel project. Laravel auto-discovery should register the service provider and Gravatar facade; publish the config only if you want to customize defaults. Commit the config and verify a generated URL in staging before migrating Blade call sites.
How do I generate a Gravatar URL from an email in Blade?
Call Gravatar::get($user->email) or the package helper from your Blade template or model accessor. Normalize the email first by trimming and lowercasing so the hash is stable across requests. Use the returned string as the img src and escape it like any other output.
Which Laravel and PHP versions does creativeorange/gravatar support?
The package began as a Laravel 5 Gravatar package, while current constraints align with PHP 8.1+ and Laravel 10+. Laravel 11, 12, and 13 support may arrive through automated compatibility PRs, which prove Composer constraint satisfaction rather than functional verification in your app. Check the Composer constraints and run a staging smoke test before upgrading.
How do I change Gravatar size, default image, and rating?
Publish the package config and set your default size, fallback image, rating, and secure URL preference there. Where supported by the facade, pass per-call overrides for specific views or models. Keep sizes within Gravatar bounds and correctly encode the fallback parameter so URLs stay valid.
What does Gravatar::exists() do and should I call it in a Blade view?
Gravatar::exists() performs a synchronous outbound HTTP call to Gravatar to check whether an avatar image exists. It is fine as cached background enrichment, but it is an anti-pattern in a render path or a Blade loop over many users. If you use it, define a cache TTL and monitor p95 latency.
How do I publish and configure the gravatar config file?
Run php artisan vendor:publish and select the creativeorange/gravatar provider or tag to publish its config. Edit the generated config file to set defaults for image size, fallback image, rating, and secure URLs. Commit the config so all environments generate consistent avatar URLs.
Why did avatars disappear after updating creativeorange/gravatar?
A SHA-256 hashing change shipped in the v1.0.25 patch, which silently invalidates previously generated Gravatar URLs. Old application and CDN caches can then make avatars appear gone for all users at once. Pin the package version deliberately, review changelogs, clear caches, and verify a known test account after every upgrade.
How can I test or mock Gravatar URLs without network calls?
The Gravatar facade is mockable, so unit tests can use Gravatar::shouldReceive('get')->andReturn(...) without hitting the network. Avoid calling exists() in tested request paths because it makes a real outbound HTTP request. Keep one integration smoke test in staging or CI that verifies a known account returns a real image.
Is creativeorange/gravatar GDPR or privacy safe for production?
Every generated Gravatar URL sends a hash of the user email to Automattic infrastructure; a hashed email is generally pseudonymous but is still a third-party disclosure and per-user tracking signal. exists() is more sensitive because it discloses account existence for arbitrary emails. Get privacy review and a lawful basis for EU users, and consider a config kill switch or local avatar fallback.
What are alternatives to creativeorange/gravatar?
You can build the Gravatar URL manually from the email hash plus size, default, and rating query parameters. Other options include another maintained Gravatar package, UI Avatars, locally stored uploads, or avatar URLs from Laravel Socialite providers. The capability is replaceable in roughly an afternoon, so avoid treating this package as a strategic dependency.
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.
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
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
cgv/localized-resource
noith/settings