PHPackages                             emanueleminotto/gravatar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. emanueleminotto/gravatar

ActiveLibrary[Templating &amp; Views](/categories/templating)

emanueleminotto/gravatar
========================

PHP library for gravatar.com

1.1.0(11y ago)076412MITPHP

Since Jan 31Pushed 10y ago1 watchersCompare

[ Source](https://github.com/EmanueleMinotto/Gravatar)[ Packagist](https://packagist.org/packages/emanueleminotto/gravatar)[ RSS](/packages/emanueleminotto-gravatar/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (2)

Gravatar
========

[](#gravatar)

[![Build Status](https://camo.githubusercontent.com/a24c789350800747506d8beee6c0d24091b4131bb507e138599df86450a7407f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f456d616e75656c654d696e6f74746f2f47726176617461722e7376673f7374796c653d666c6174)](https://travis-ci.org/EmanueleMinotto/Gravatar)[![SensioLabs Insight](https://camo.githubusercontent.com/b33f7ebeef64703185541edec7b2eecbff1ec937a1f3de01778d3e5c81e8380f/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f39643936323132312d346563372d346236352d626430362d3632323939343234613138302e7376673f7374796c653d666c6174)](https://insight.sensiolabs.com/projects/9d962121-4ec7-4b65-bd06-62299424a180)[![Coverage Status](https://camo.githubusercontent.com/14fdb0d743d27a04ca8f03aba905829c5fc3e56af3f41bf9b64975ee64c5a632/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f456d616e75656c654d696e6f74746f2f47726176617461722e7376673f7374796c653d666c6174)](https://coveralls.io/r/EmanueleMinotto/Gravatar)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2dd6a758104973668ea8527dd1abe23709a79da3625a0a83dcffedb3f040d369/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f456d616e75656c654d696e6f74746f2f47726176617461722e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/EmanueleMinotto/Gravatar/)[![Total Downloads](https://camo.githubusercontent.com/63fbd08951c8c4b2372a862e73f9384dbe129b7549d005bf33cdf57a267dd0af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656d616e75656c656d696e6f74746f2f67726176617461722e7376673f7374796c653d666c6174)](https://packagist.org/packages/emanueleminotto/gravatar)

PHP library for [gravatar.com](http://www.gravatar.com/) based on [Guzzle 5](http://docs.guzzlephp.org/en/latest/).

API: [emanueleminotto.github.io/Gravatar](http://emanueleminotto.github.io/Gravatar/)

Install
-------

[](#install)

Install Silex using [Composer](http://getcomposer.org/).

Install the Gravatar library adding `emanueleminotto/gravatar` to your composer.json or from CLI:

```
$ composer require emanueleminotto/gravatar

```

Usage
-----

[](#usage)

This library exposes 5 APIs:

```
use EmanueleMinotto\Gravatar\Client;

$client = new Client(/* optional Guzzle HTTP client */);

// user profile
$url = $client->getProfileUrl('user@example.com'); // https://www.gravatar.com/b58996c504c5638798eb6b511e6f49af.json
$qrcode = $client->getProfileUrl('user@example.com', 'qr'); // https://www.gravatar.com/b58996c504c5638798eb6b511e6f49af.qr
$qrcode = $client->getProfileUrl('user@example.com', 'json', [
    'callback' => 'alert',
]); // https://www.gravatar.com/b58996c504c5638798eb6b511e6f49af.json?callback=alert

$profile = $client->getProfile('user@example.com');
// array(
//   "id" => "b58996c504c5638798eb6b511e6f49af",
//   "hash" => "b58996c504c5638798eb6b511e6f49af",
//   "preferredUsername" => "example user",
//   ...
// )

// user avatar
$img = $client->getAvatarUrl('user@example.com'); // https://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg?d=404&r=g&s=80
$img = $client->getAvatarUrl('user@example.com', 150); // https://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg?d=404&r=g&s=150

$img = $client->getAvatar('user@example.com'); // data URI
$img = $client->getAvatar('user@example.com', 150); // data URI

$exists = $client->exists('user@example.com'); // true
$exists = $client->exists('wrong'); // false
```

Twig Extension
--------------

[](#twig-extension)

In this library there's included a [Twig](http://twig.sensiolabs.org/) extension to allow a simple integration with frameworks.

```
{% if email is gravatar %} {# this test check if the gravatar exists #}

{% endif %}
```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

4116d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/30b6fbd038f22a54716027eb7ce30c6cafd8e59c138ae58b3c2516c34ccfef7f?d=identicon)[EmanueleMinotto](/maintainers/EmanueleMinotto)

---

Top Contributors

[![EmanueleMinotto](https://avatars.githubusercontent.com/u/417201?v=4)](https://github.com/EmanueleMinotto "EmanueleMinotto (16 commits)")

---

Tags

twiggravatar

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/emanueleminotto-gravatar/health.svg)

```
[![Health](https://phpackages.com/badges/emanueleminotto-gravatar/health.svg)](https://phpackages.com/packages/emanueleminotto-gravatar)
```

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91292.0M314](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36663.2M219](/packages/twig-intl-extra)[twig/string-extra

A Twig extension for Symfony String

21946.0M132](/packages/twig-string-extra)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

23018.5M53](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21814.8M161](/packages/symfony-ux-twig-component)[twig/markdown-extra

A Twig extension for Markdown

12114.3M83](/packages/twig-markdown-extra)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
