tomshaw/laravel-gravatar
Gravatar avatars, profiles, and QR codes for Laravel. Zero config to start, configurable when you need it, with a Blade directive and component for rendering, a facade and fluent builder for URLs, plus model support, profiles, QR codes, and hashing.
<x-gravatar /> owns the <img> markup, so retina srcset and an outage fallback arrive without design or eng debate — which pre-empts the two predictable post-launch tickets: "avatars are blurry on my MacBook" and "every avatar is a broken image during a Gravatar incident."srcset capped at Gravatar's 2048px ceiling, an onerror local fallback that is distinct from Gravatar's own default: image, SHA256 instead of reversible MD5, parameter validation that throws at render instead of emitting dead URLs, cached has()/profile() calls (negative results included, so missing profiles don't re-request per page load), and a fake() so CI stops depending on a third-party HTTP service. That — not the URL string — is the estimate to compare against.Gravatar::profile() returns display name, location, job title, company, pronouns, and verified accounts with no API key. That's a one-sprint, killable bet for pre-filling onboarding forms, suggesting a headline in a profile editor, or adding trust signals to a marketplace listing. If it doesn't move activation, we delete a config line.type: 'user' (avatar in the centre) is the version worth demoing to design; version: 3 is the modern-dots style.Gravatar::fake() with assertLookedUp/assertNothingLookedUp converts an external HTTP dependency into deterministic fixtures. Small win, but a defensible one on engineering-time grounds alone.Adoption gate — all of these must hold:
composer.json, keep every call site behind our own AvatarService or a single Blade partial, and don't let the HasGravatar trait leak into domain models other teams consume.fallback prop fixes the visual failure, not the dependency itself.Look elsewhere when:
creativeorange/gravatar (the established Laravel option) or a ~40-line internal helper.default: parameter is the seam where those plug in.Executives: "A small MIT-licensed utility that removes a recurring class of polish bugs — blurry avatars on high-density screens, broken-image icons whenever a third party has an outage — and gives us a zero-cost option to pull public profile data (name, title, company) into onboarding. Cost is one composer line and no vendor contract. The risk is that it's a one-person open-source project targeting the newest PHP/Laravel versions, so we pin the version, wrap it behind one internal interface, and can replace it in an afternoon if it's abandoned. Recommendation: adopt as a convenience dependency, not platform infrastructure, and revisit if avatars become a product differentiator."
Engineering: "Thin, tested wrapper over Gravatar URLs that handles what we'd otherwise forget: SHA256 by default, 2x srcset auto-skipped past the 2048px ceiling, an onerror local fallback distinct from Gravatar's default: image, strict parameter validation that throws instead of emitting dead URLs, cached has()/profile() with negative caching, and Gravatar::fake() so tests never touch the network. Four entry points — Blade directive (URL only, goes in your own src), component (owns the <img>, adds srcset + fallback, forwards attributes), facade, and a fluent builder that stringifies straight into Blade. Only two methods hit the wire, both cached and both TTL-configurable. Caveats: requires PHP 8.5 / Laravel 13, single maintainer, no downstream users — so pin it, and keep every call site behind our own AvatarService so the exit cost stays near zero."
How can I help you explore Laravel packages today?