PHPackages                             forxer/laravel-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/laravel-gravatar

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

forxer/laravel-gravatar
=======================

A library providing easy gravatar integration in a Laravel project.

6.0.0(1mo ago)4235.6k↓23.5%10MITPHPPHP ^8.4

Since Aug 31Pushed 1mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (13)Versions (30)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/b7f95ed77b91fbbf49d20b5d47a728ee36f17d65eb5db5bdeffe074fd75ac653/687474703a2f2f706f7365722e707567782e6f72672f666f727865722f6c61726176656c2d67726176617461722f76)](https://packagist.org/packages/forxer/laravel-gravatar)[![Total Downloads](https://camo.githubusercontent.com/2af35bb1dfae0c5611c0041245103b9cb2c87584875592202b4a62336fbe8e81/687474703a2f2f706f7365722e707567782e6f72672f666f727865722f6c61726176656c2d67726176617461722f646f776e6c6f616473)](https://packagist.org/packages/forxer/laravel-gravatar)[![License](https://camo.githubusercontent.com/7ae49adf52fc3c8042eb3ce65f5f7f5b175d470e41a378020cd37ff906cd22b3/687474703a2f2f706f7365722e707567782e6f72672f666f727865722f6c61726176656c2d67726176617461722f6c6963656e7365)](https://packagist.org/packages/forxer/laravel-gravatar)

Gravatar for Laravel
====================

[](#gravatar-for-laravel)

This package provides an easy Gravatar integration in a Laravel project.

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

// Simple usage
$avatar = gravatar('email@example.com')
    ->size(120)
    ->defaultImage('robohash')
    ->extension('jpg');
echo $avatar;

// With type-safe enums
$avatar = gravatar('email@example.com')
    ->size(120)
    ->defaultImage(DefaultImage::ROBOHASH)
    ->extension(Extension::JPG);

// With fluent shorthand methods
$avatar = gravatar('email@example.com')
    ->size(120)
    ->extensionJpg()
    ->defaultImageRobohash();
```

About this package
------------------

[](#about-this-package)

This Laravel package is built on top of the framework-agnostic **[forxer/gravatar](https://github.com/forxer/gravatar)** library. It extends the base functionality by adding:

- **Laravel-specific features**: Service providers, facades, helper functions (`gravatar()` and `gravatar_profile()`), and configuration
- **Extended classes**: `LaravelGravatar\Image` extends `Gravatar\Image`, and `LaravelGravatar\Profile` extends `Gravatar\Profile`
- **Additional Laravel integrations**: Eloquent casts, preset configurations, and base64 conversion with Laravel's HTTP client
- **Full support for PHP 8.4 features**: Property hooks, type-safe enums, and fluent shorthand methods from the parent library

All the core Gravatar functionality from the parent library is available in this package.

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

[](#documentation)

**Complete documentation is available in the [docs](docs/) directory:**

- **[Overview](docs/index.md)** - Introduction and quick start
- **[Installation](docs/installation.md)** - Install and configure
- **[Usage](docs/usage.md)** - Helpers, facades, and dependency injection
- **[Parameters](docs/parameters.md)** - All available Gravatar parameters
- **[Enums](docs/enums.md)** - Type-safe enums and fluent methods
- **[Configuration](docs/configuration.md)** - Configure the package
- **[Presets](docs/presets.md)** - Complete guide to preset configurations
- **[Casts](docs/casts.md)** - Eloquent model integration
- **[Advanced Features](docs/advanced.md)** - Base64 conversion, copying, and more

Requirements
------------

[](#requirements)

- **PHP 8.4+**
- **Laravel 12.0+**

For earlier versions:

- [Version 4.x](https://github.com/forxer/laravel-gravatar/tree/4.x) - PHP 8.2+ and Laravel 10.0+
- [Version 2.x](https://github.com/forxer/laravel-gravatar/tree/2.x) - PHP 8.0+ and Laravel 8.0+
- [Version 1.x](https://github.com/forxer/laravel-gravatar/tree/1.x) - Older versions

Quick Installation
------------------

[](#quick-installation)

```
composer require forxer/laravel-gravatar
```

The service provider is automatically registered via package discovery.

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

[](#quick-start)

```
// Simple usage with helper

// With configuration
$avatar = gravatar('user@example.com')
    ->size(120)
    ->extensionWebp()
    ->defaultImageRobohash();

// Using presets
$avatar = gravatar($user->email, 'small');

// With Eloquent casts
class User extends Model
{
    protected $casts = [
        'email' => GravatarImage::class.':medium',
    ];
}

// In Blade

```

Key Features
------------

[](#key-features)

- **Helper functions** - `gravatar()` and `gravatar_profile()` for quick access
- **Facade support** - `Gravatar::image()` and `Gravatar::profile()`
- **Eloquent casts** - Seamless model integration
- **Preset configurations** - Define reusable avatar settings with automatic validation
- **Preset key validation** - Preset keys validated against `PresetKey` enum, values validated by parent library's property hooks
- **Base64 conversion** - Convert avatars to data URLs
- **PHP 8.4 property hooks** - Direct property access with validation
- **Type-safe enums** - `Rating`, `Extension`, `DefaultImage`
- **Fluent shorthand methods** - `extensionWebp()`, `ratingPg()`, `defaultImageRobohash()`

Version History
---------------

[](#version-history)

See [CHANGELOG.md](CHANGELOG.md) for all changes.

Upgrading
---------

[](#upgrading)

See [UPGRADE.md](UPGRADE.md) for upgrade instructions between major versions.

License
-------

[](#license)

This package is open-source software licensed under the [MIT license](LICENSE).

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity41

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95.1% 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 ~115 days

Recently: every ~31 days

Total

28

Last Release

57d ago

Major Versions

1.x-dev → 2.0.02023-03-18

2.x-dev → 3.0.02023-03-22

3.0.0 → 4.0.02024-05-26

4.3.0 → 5.0.02025-11-17

5.1.0 → 6.0.02026-03-22

PHP version history (4 changes)1.0.0PHP &gt;=5.6.4

2.0.0PHP ^8.0.0

4.0.0PHP ^8.2

5.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 (77 commits)")[![Limych](https://avatars.githubusercontent.com/u/8019701?v=4)](https://github.com/Limych "Limych (2 commits)")[![code2prog](https://avatars.githubusercontent.com/u/22845213?v=4)](https://github.com/code2prog "code2prog (1 commits)")[![mbalandis](https://avatars.githubusercontent.com/u/18264973?v=4)](https://github.com/mbalandis "mbalandis (1 commits)")

---

Tags

gravatarlaravellaravelgravatar

###  Code Quality

TestsPest

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[nickurt/laravel-akismet

Akismet for Laravel 11.x/12.x/13.x

97139.6k2](/packages/nickurt-laravel-akismet)[whitecube/laravel-timezones

Store UTC dates in the database and work with custom timezones in the application.

106106.2k](/packages/whitecube-laravel-timezones)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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