Download the PHP package tomshaw/laravel-gravatar without Composer

On this page you can find all versions of the php package tomshaw/laravel-gravatar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-gravatar

Laravel Gravatar 📸

Gravatar avatars, profiles, and QR codes for Laravel — zero config to start, configurable when you need it.

GitHub Workflow Status issues forks stars GitHub license

blank mp identicon monsterid wavatar retro robohash blank

Installation

That's everything — the package auto-registers and every default is sensible. Publish the config only if you want to change them:

Rendering avatars

The directive

@gravatar outputs a URL, so it goes inside a src attribute you write yourself:

Every parameter is named and optional except email.

The component

<x-gravatar /> emits the whole <img> tag. Because it owns the markup, it can do three things the directive structurally cannot: forward your attributes, add a 2x srcset for high-density displays, and swap in a local image when the browser can't reach Gravatar at all.

Prop Default Notes
email — Required.
size config Also sets width/height, which your own attributes override.
default rating secure extension hash config As per parameter reference.
force-default false A real boolean here, rather than the directive's 'y'/'n'.
retina true Emits the 2x srcset. Skipped automatically when doubling would exceed Gravatar's 2048px ceiling.
fallback config Local image swapped in via onerror. A relative path resolves through asset().

Note that default and fallback solve different problems. default is rendered by Gravatar when an address has no avatar, so it needs Gravatar to be reachable. fallback is what the browser shows when the request fails outright — a dropped connection, an outage, DNS.

Publish the view to change the markup:

Building URLs

The facade

Fluent builder

Each built-in default image is a shorthand — ->mp(), ->identicon(), ->monsterid(), ->wavatar(), ->retro(), ->robohash(), ->blank(), ->initials(), ->color().

The builder resolves to a URL when cast to a string, so it can be echoed straight into Blade:

Models

The address is read from the gravatar.email_column config value. Override it per-model:

Every method is prefixed deliberately. Eloquent resolves bare property access through relations and attribute mutators, so a trait method named gravatar() would make $user->gravatar throw a LogicException. Reach for Gravatar::for($user->email) when you want the fluent builder on a model.

Profiles

profile() returns a Profile, or null when the address has no Gravatar account.

This works with no API key. Gravatar withholds some fields from anonymous callers — timezone, languages, contact info, links, interests, payments, gallery images — and caps verified accounts at four. Set a key to receive full profiles and a higher rate limit:

Keys are free from gravatar.com/developers.

profile() and has() are the only methods that touch the network, so both cache — misses included, so a missing profile doesn't re-request on every page load. Set gravatar.cache.ttl to 0 to disable.

QR codes

version is 1 (standard) or 3 (modern dots). type is default (no logo), user (the user's avatar in the centre), or gravatar (the Gravatar logo).

Hashing

Gravatar specifies SHA256 and explicitly says not to use MD5, which is reversible and can leak the address it was built from. This package defaults to SHA256.

MD5 stays available for URLs generated before the change:

Or set gravatar.hash to md5 globally.

Testing

Gravatar::fake() answers has() and profile() from canned data and makes no HTTP calls. URL building is left alone, since it never hit the network to begin with.

Emails in profiles also report as existing. Lookups are recorded:

Configuration

Values passed at a call site always win over config.

Parameter reference

Accepted by src(), the directive, and (minus email) the component.

Parameter Type Default Accepts
email string — Required.
size int 80 1–2048.
default string mp mp, identicon, monsterid, wavatar, retro, robohash, blank, 404, initials, color, or a publicly reachable URL.
rating string g g, pg, r, x.
secure bool true Uses secure.gravatar.com.
forceDefault string n y always loads the default image.
forceExtension string jpg jpg, jpeg, png, gif, webp, or '' for none.
hash string sha256 sha256, md5.

Anything outside these throws an InvalidArgumentException, so a typo fails loudly at render rather than silently producing a dead URL.

Requirements

Contributing

License

The MIT License (MIT). See License File for more information.


All versions of laravel-gravatar with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
laravel/framework Version ^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tomshaw/laravel-gravatar contains the following files

Loading the files please wait ...