pespantelis/gravatar 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pespantelis/gravatar

最新稳定版本:1.0.0

Composer 安装命令:

composer require pespantelis/gravatar

包简介

Gravatar url builder

README 文档

README

Gravatar is a service for providing globally unique avatars.

Installation

Begin by installing this package through Composer.

composer require pespantelis/gravatar

Usage

Create and initialize a gravatar url builder.

<?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);

Generate a Gravatar url for the requested email.

echo $gravatar->url('pespantelis@gmail.com');

Check if the requested email has an associated image.

echo $gravatar->exists('pespantelis@gmail.com');
// or
echo $gravatar->url('pespantelis@gmail.com')->exists();

Override the options.

// size
echo $gravatar->url('pespantelis@gmail.com', 256);
// or
echo $gravatar->url('pespantelis@gmail.com')->size(256);

// secure requests
echo $gravatar->url('pespantelis@gmail.com')->secure();

// default image
echo $gravatar->url('pespantelis@gmail.com')->defaultImage('identicon');

// force default image
echo $gravatar->url('pespantelis@gmail.com')->forceDefault();

// rating level
echo $gravatar->url('pespantelis@gmail.com')->rating('pg');

Method chaining to set options.

echo $gravatar->url('pespantelis@gmail.com', 256)->defaultImage('identicon')->rating('pg');

Laravel Extension

If you are a Laravel user, there is a README.md here.

License

Gravatar is released under the MIT Licence. See the bundled LICENSE file for details.

统计信息

  • 总下载量: 190
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-22