Gravatar
Gravatar stats
- Downloads
- 4.8M
- Stars
- 518
- Open Issues
- 4
- Forks
- 58
A Laravel Gravatar package for retrieving gravatar image URLs or checking the existance of an image.
Gravatar for Laravel 5 - 10
The creativeorange/gravatar package is a convenient Laravel integration for working with Gravatar - a service that provides globally recognized avatars. Designed to be compatible with Laravel versions 5 through 10, this package simplifies the process of fetching Gravatar images associated with email addresses.
Key Features
- Fetch Gravatar Images: Easily retrieve the URL to the Gravatar image for any email.
- Default Image Fallbacks: Specify a default image in cases where no Gravatar exists for the given email.
- Check Existence: Verify the presence of a Gravatar for a particular email.
- Customizable: Modify Gravatar size, fallback image, security settings, and more through configuration.
- Multiple Configuration Profiles: Supports multiple preset configurations for different use cases.
Installation
-
Via Composer:
composer require creativeorange/gravatar ~1.0 -
Service Provider:
- For Laravel 5.3 and below, add to
app/config/app.php:'providers' => ['Creativeorange\Gravatar\GravatarServiceProvider']; - For Laravel 5.4 and above, use
config/app.php:'providers' => [Creativeorange\Gravatar\GravatarServiceProvider::class];
- For Laravel 5.3 and below, add to
-
Facade Alias (Optional):
- For Laravel 5.3 and below:
'aliases' => ['Gravatar' => 'Creativeorange\Gravatar\Facades\Gravatar',];
- For Laravel 5.4 and above:
'aliases' => ['Gravatar' => Creativeorange\Gravatar\Facades\Gravatar::class,];
- For Laravel 5.3 and below:
-
Publish Configuration:
php artisan vendor:publish
Usage
-
Retrieve a Gravatar URL:
Gravatar::get('email@example.com'); -
Check for Gravatar Existence:
Gravatar::exists('email@example.com'); -
Use a Custom Fallback Image:
Gravatar::fallback('http://urlto.example.com/avatar.jpg')->get('email@example.com'); -
Specify Configuration on-the-fly:
Gravatar::get('email@example.com', 'small-secure');Gravatar::get('email@example.com', ['size'=>200]);
This package offers a streamlined way to integrate Gravatar functionality into your Laravel applications, enhancing your user profiles with globally recognized avatars. Configurable and easy to use, it fits well within the Laravel ecosystem.