PHPackages                             forxer/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. forxer/gravatar

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

forxer/gravatar
===============

A library providing easy gravatar integration.

7.0.0(3mo ago)35208.0k↓47.2%37MITPHPPHP ^8.4

Since Feb 19Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/forxer/gravatar)[ Packagist](https://packagist.org/packages/forxer/gravatar)[ Docs](https://github.com/forxer/gravatar)[ RSS](/packages/forxer-gravatar/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (6)Versions (32)Used By (7)

[![Latest Stable Version](https://camo.githubusercontent.com/c45fe695b4528acdf9fc1bc40e9cf81866a8d11cbc4a8ba5add824ae23730f29/68747470733a2f2f706f7365722e707567782e6f72672f666f727865722f67726176617461722f76)](https://packagist.org/packages/forxer/gravatar)[![Total Downloads](https://camo.githubusercontent.com/6991ad351ba14fb68ddc2f0f6affcc699a5622de340db6ded416db926261ffc8/68747470733a2f2f706f7365722e707567782e6f72672f666f727865722f67726176617461722f646f776e6c6f616473)](https://packagist.org/packages/forxer/gravatar)[![License](https://camo.githubusercontent.com/d53617e5435a916d7cf18438338f4ee2a0de240447d9f2acca32c5fb43e93a93/68747470733a2f2f706f7365722e707567782e6f72672f666f727865722f67726176617461722f6c6963656e7365)](https://packagist.org/packages/forxer/gravatar)

Gravatar
========

[](#gravatar)

Gravatar is a small library intended to provide easy integration of... [Gravatar](https://gravatar.com) :) It will help you generate the URL for Gravatar images and profiles in many ways.

To use it in a **Laravel project**, please look at: **[laravel-gravatar](https://github.com/forxer/laravel-gravatar)**

```
use Gravatar\Gravatar;
use Gravatar\Enum\DefaultImage;
use Gravatar\Enum\Extension;

$avatar = Gravatar::image('email@example.com')
    ->size(120)
    ->defaultImage(DefaultImage::ROBOHASH)
    ->extension(Extension::JPG);
//...
echo $avatar;
```

Documentation
-------------

[](#documentation)

- **[Installation](docs/installation.md)** - Requirements and installation instructions
- **[Usage](docs/usage.md)** - How to use the library (helpers, base class, dedicated classes)
- **[Type-safe enums](docs/enums.md)** - Using enums and fluent shorthand methods
- **[Optional parameters](docs/parameters.md)** - All available parameters and configurations
- **[Upgrade guide](UPGRADE.md)** - Migration guides between major versions
- **[Changelog](CHANGELOG.md)** - Version history and changes

Quick Start
-----------

[](#quick-start)

### Installation

[](#installation)

```
composer require forxer/gravatar
```

**Requires PHP 8.4 or newer.** For older PHP versions, see [Installation](docs/installation.md).

### Basic Usage

[](#basic-usage)

```
use Gravatar\Gravatar;

// Get a Gravatar image URL
echo Gravatar::image('email@example.com');
// output: https://www.gravatar.com/avatar/5658ffccee7f0ebfda2b226238b1eb6e

// With parameters
$avatar = Gravatar::image('email@example.com')
    ->size(120)
    ->ratingPg()
    ->extensionWebp()
    ->defaultImageRobohash();
echo $avatar;

// Get a Gravatar profile URL
echo Gravatar::profile('email@example.com')->formatJson();
```

### Key Features

[](#key-features)

**Type-safe enums** for better IDE support:

```
use Gravatar\Enum\Rating;
use Gravatar\Enum\Extension;
use Gravatar\Enum\DefaultImage;

$image->maxRating(Rating::PG)
    ->extension(Extension::WEBP)
    ->defaultImage(DefaultImage::ROBOHASH);
```

**Fluent shorthand methods** for cleaner syntax:

```
$image->ratingPg()
    ->extensionWebp()
    ->defaultImageRobohash();
```

**Multiple usage patterns** - helpers, static methods, or direct instantiation:

```
// Using helpers (define your own)
$avatar = gravatar('email@example.com')->size(120);

// Using static methods
$avatar = Gravatar::image('email@example.com')->size(120);

// Direct instantiation
$avatar = new Image('email@example.com');
$avatar->size(120);
```

For more details, see the [full documentation](docs/).

License
-------

[](#license)

This library is licensed under the MIT license; you can find a full copy of the license itself in the file /LICENSE

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance80

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity92

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 96.7% 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 ~152 days

Recently: every ~32 days

Total

30

Last Release

104d ago

Major Versions

2.1.x-dev → 3.0.02023-03-16

3.x-dev → 4.0.02023-03-16

4.x-dev → 5.0.02024-05-26

5.x-dev → 6.0.02025-11-17

6.0.0 → 7.0.02026-03-22

PHP version history (5 changes)1.0PHP &gt;=5.3.0

1.2PHP &gt;=5.4.0

3.0.0PHP ^8.0

5.0.0PHP ^8.2

6.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/aa033b458252f6496cc81308d72b97fcd3412545e50bb2017593eacff939771b?d=identicon)[forxer](/maintainers/forxer)

---

Top Contributors

[![forxer](https://avatars.githubusercontent.com/u/407917?v=4)](https://github.com/forxer "forxer (119 commits)")[![daniser](https://avatars.githubusercontent.com/u/5169543?v=4)](https://github.com/daniser "daniser (4 commits)")

---

Tags

phpgravatar

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21623.4k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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