Gravatar is a service that offers distinctive worldwide avatars and has integrated it into their blogging platform If they have registered on and you don't have an avatar image, you can receive a Gravatar src image from their email. Therefore, it is quite simple to implement in your Laravel application. There are a number of packages for using Gravatar images with Laravel, but we'll pick the one that's, in my opinion, the best: thomaswelton/laravel-gravatar.

Installation Package

composer require thomaswelton/laravel-gravatar

Once this package has been installed, enter the config/app.php file and add the service provider and alias.


'providers' => [
'aliases' => [
	'Gravatar' => Thomaswelton\LaravelGravatar\Facades\Gravatar::class

Okay, so here's how we can use Gravatar in our blade file:

Use In Blade File

You can use it in your application now by doing as follows:

If the $email is linked to Gravatar, Gravatar::exists($email) will return boolean, informing you of the situation.

The whole URL for the Gravatar registered email address will be returned by the command Gravatar::src($email, $size = null, $rating = null).

<img src="{{ Gravatar::src('[email protected]', 200) }}">

We hope that the code and information in this post will help you use the thomaswelton/laravel-gravatar package to load a gravatar image in Laravel 9. If you require assistance or have any comments or suggestions regarding this post, please share them in the comment area.

Recommended Posts

View All

Create Zip file and Download in Laravel 9

After we have compressed the files, let's download the Laravel 9 zip files. In this tutorial, we'll use the ZipArchive class and a Laravel package to...

Laravel 8 Import Export Excel & CSV File Example

Using the Maatwebsite/Laravel-Excel package, you will learn how to easily import and export Excel and CSV files in the Laravel 8 application while com...

Laravel 9 FullCalendar Ajax Tutorial with Example

We&amp;#039;ll show you how to use the Fullcalendar JavaScript event calendar plugin to add FullCalendar to your Laravel app and create and cancel eve...

Laravel 9 Capture Image from Webcam and Store in Database

Learn how to capture images from webcam using Laravel 9 and store them in a database. Step-by-step guide with code examples and best practices.

Laravel 9 Elasticsearch Integration From Scratch With Example

In this post, we'll talk about how to incorporate Elasticsearch from scratch using a Laravel 9 example.