danrovito/laravel-gravatar

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Uses the authorized users email to display their Gravatar as an image

1.3.3 2017-09-11 02:05 UTC

This package is auto-updated.

Last update: 2021-07-29 01:29:43 UTC


README

Latest Stable Version Total Downloads License StyleCI

Laravel Gravatar is a simple Laravel package that displays a registered users Gravatar based on their email address in your users table. If the user does not have a registered gravatar it will show the default mystery man.

Mystery Man

Installation

Via Composer

composer require danrovito/laravel-gravatar

Usage

Use Gravatar in your User model.

<?php

namespace App;

use Darovi\Gravatar;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
  use Gravatar;
 
  // ...
}

You can also control what attribute should be treated as the email address (instead of email) by overriding the emailAttributeName() method:

<?php

namespace App;

use Darovi\Gravatar;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
  use Gravatar;
  
  protected function emailAttributeName()
  {
    return 'your_email_column';
  }
  
  // ...
}

Then in your view wherever you want to use the Gravatar

<img src="{{ Auth::user()->gravatar }}">

License

Laravel Slack Invite is open-sourced software licensed under the MIT license

Bug Reporting and Feature Requests

Please add as many details as possible regarding submission of issues and feature requests

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.