dionbosschieter / gravatar
Simple transformer to get a gravatar url on a User model
0.2
2015-11-15 13:16 UTC
Requires (Dev)
- phpspec/phpspec: ~2.0
This package is not auto-updated.
Last update: 2024-12-25 18:01:44 UTC
README
Install Gravatar using composer:
composer require dionbosschieter/gravatar
Implement the avataruserinterface on your users model
use Gravatar\UserGravatarInterface
The gravatar class expects a getEmailAdres
method on your user model
<?php use Gravatar\UserGravatarInterface; class User extends Model { public function getEmailAdres() { return $this->email; } }
##Usage
$avatar = new \Gravatar\Gravatar($usermodel); $avatar->getImageUrl(); $avatar->getImageUrlForSize();
Register the class using your frameworks dependency container:
// Laravel App::bind('gravatar', function() { $grav = new \Gravatar\Gravatar(app('auth')->user()); return $grav; });