Home

Awesome

Gravatar image provider for Faker

Tests Latest Version

It is Gravatar image provider for fzaninotto/Faker fakerphp/faker

Here are some examples of generated avatars:

mp (mode: mp)

identicon (mode: identicon)

monsterid (mode: monsterid)

wavatar (mode: wavatar)

retro (mode: retro)

robohash (mode: robohash)

blank (mode: blank, transparent image)

Requirements

Installation

composer require ottaviano/faker-gravatar --dev

Usage

<?php

// ...

$faker = Faker\Factory::create();
$faker->addProvider(new Ottaviano\Faker\Gravatar($faker));

$imageLocalPath = $faker->gravatar();
$imageContent = file_get_contents($imageLocalPath);

// OR

$imageUrl = $faker->gravatarUrl();