pespantelis/gravatar is a Laravel package for gravatar url builder.
It currently has 5 GitHub stars and 194 downloads on Packagist (latest version 1.0.0).
Install it with composer require pespantelis/gravatar.
Discover more Laravel packages by pespantelis
or browse all Laravel packages to compare alternatives.
Last updated
Gravatar is a service for providing globally unique avatars.
Begin by installing this package through Composer.
composer require pespantelis/gravatar
<?php
// require the Gravatar autoloader
require 'vendor/autoload.php';
// set options (optional)
$options = [
'size' => 256,
'default-image' => 'identicon',
'force-default' => false,
'rating' => 'pg',
'secure' => true
];
$gravatar = new Peslis\Gravatar\Factory($options);
echo $gravatar->url('[email protected]');
echo $gravatar->exists('[email protected]');
// or
echo $gravatar->url('[email protected]')->exists();
// size
echo $gravatar->url('[email protected]', 256);
// or
echo $gravatar->url('[email protected]')->size(256);
// secure requests
echo $gravatar->url('[email protected]')->secure();
// default image
echo $gravatar->url('[email protected]')->defaultImage('identicon');
// force default image
echo $gravatar->url('[email protected]')->forceDefault();
// rating level
echo $gravatar->url('[email protected]')->rating('pg');
echo $gravatar->url('[email protected]', 256)->defaultImage('identicon')->rating('pg');
If you are a Laravel user, there is a README.md here.
Gravatar is released under the MIT Licence. See the bundled LICENSE file for details.