remzikocak/laravel-gravatar
最新稳定版本:3.0.0
Composer 安装命令:
composer require remzikocak/laravel-gravatar
包简介
Gravatar Generator for Laravel 9/10/11/12
关键字:
README 文档
README
This Package will help you to Generate Gravatar URL's with Laravel.
Installation
You can install the package via composer:
composer require remzikocak/laravel-gravatar
Usage
Get Users Gravatar URL:
Gravatar::url('test@example.com');
Get Users Gravatar with Custom Configuration:
Gravatar::for('test@example.com') ->size(150) ->default('identicon') ->rating('x') ->get();
Get HTML Image Tag:
Gravatar::img('test@example.com')
Get HTML Image Tag with attributes:
Gravatar::img('test@example.com', [ 'class' => 'w-10 h-10 rounded-full' ])
Check if Gravatar for an email exists:
Gravatar::exists('test@example.com')
Get Gravatar using 'HasGravatar' trait:
First add 'HasGravatar' trait to your User Model.
<?php namespace App; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use RKocak\Gravatar\Traits\HasGravatar; class User extends Authenticatable { use Notifiable, HasGravatar;
after adding the Trait, you can use it like this
$user = App\User::find(1); // This will return the Gravatar URL $user->getGravatar(); // or get the Generator instance with preset email $generator = $user->getGravatarGenerator();
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 928
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-12