承接 emanueleminotto/gravatar 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

emanueleminotto/gravatar

最新稳定版本:1.1.0

Composer 安装命令:

composer require emanueleminotto/gravatar

包简介

PHP library for gravatar.com

README 文档

README

Build Status SensioLabs Insight Coverage Status Scrutinizer Code Quality Total Downloads

PHP library for gravatar.com based on Guzzle 5.

API: emanueleminotto.github.io/Gravatar

Install

Install Silex using Composer.

Install the Gravatar library adding emanueleminotto/gravatar to your composer.json or from CLI:

$ composer require emanueleminotto/gravatar

Usage

This library exposes 5 APIs:

use EmanueleMinotto\Gravatar\Client;

$client = new Client(/* optional Guzzle HTTP client */);

// user profile
$url = $client->getProfileUrl('user@example.com'); // https://www.gravatar.com/b58996c504c5638798eb6b511e6f49af.json
$qrcode = $client->getProfileUrl('user@example.com', 'qr'); // https://www.gravatar.com/b58996c504c5638798eb6b511e6f49af.qr
$qrcode = $client->getProfileUrl('user@example.com', 'json', [
    'callback' => 'alert',
]); // https://www.gravatar.com/b58996c504c5638798eb6b511e6f49af.json?callback=alert

$profile = $client->getProfile('user@example.com');
// array(
//   "id" => "b58996c504c5638798eb6b511e6f49af",
//   "hash" => "b58996c504c5638798eb6b511e6f49af",
//   "preferredUsername" => "example user",
//   ...
// )

// user avatar
$img = $client->getAvatarUrl('user@example.com'); // https://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg?d=404&r=g&s=80
$img = $client->getAvatarUrl('user@example.com', 150); // https://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg?d=404&r=g&s=150

$img = $client->getAvatar('user@example.com'); // data URI
$img = $client->getAvatar('user@example.com', 150); // data URI

$exists = $client->exists('user@example.com'); // true
$exists = $client->exists('wrong'); // false

Twig Extension

In this library there's included a Twig extension to allow a simple integration with frameworks.

{% if email is gravatar %} {# this test check if the gravatar exists #}
    <a href="{{ email|gravatar_profile_url }}">
        <img
            src="{{ email|gravatar_url }}"
            alt="{{ gravatar_profile(email).profileUrl }}"
        />
    </a>
{% endif %}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-31