forxer/gravatar
Composer 安装命令:
composer require forxer/gravatar
包简介
A library providing easy gravatar integration.
README 文档
README
Gravatar
Gravatar is a small library intended to provide easy integration of... Gravatar :) It will help you generate the URL for Gravatar images and profiles in many ways.
To use it in a Laravel project, please look at: laravel-gravatar
use Gravatar\Gravatar; use Gravatar\Enum\DefaultImage; use Gravatar\Enum\Extension; $avatar = Gravatar::image('email@example.com') ->size(120) ->defaultImage(DefaultImage::ROBOHASH) ->extension(Extension::JPG); //... echo $avatar;
Documentation
- Installation - Requirements and installation instructions
- Usage - How to use the library (helpers, base class, dedicated classes)
- Type-safe enums - Using enums and fluent shorthand methods
- Optional parameters - All available parameters and configurations
- Upgrade guide - Migration guides between major versions
- Changelog - Version history and changes
Quick Start
Installation
composer require forxer/gravatar
Requires PHP 8.4 or newer. For older PHP versions, see Installation.
Basic Usage
use Gravatar\Gravatar; // Get a Gravatar image URL echo Gravatar::image('email@example.com'); // output: https://www.gravatar.com/avatar/5658ffccee7f0ebfda2b226238b1eb6e // With parameters $avatar = Gravatar::image('email@example.com') ->size(120) ->ratingPg() ->extensionWebp() ->defaultImageRobohash(); echo $avatar; // Get a Gravatar profile URL echo Gravatar::profile('email@example.com')->formatJson();
Key Features
Type-safe enums for better IDE support:
use Gravatar\Enum\Rating; use Gravatar\Enum\Extension; use Gravatar\Enum\DefaultImage; $image->maxRating(Rating::PG) ->extension(Extension::WEBP) ->defaultImage(DefaultImage::ROBOHASH);
Fluent shorthand methods for cleaner syntax:
$image->ratingPg() ->extensionWebp() ->defaultImageRobohash();
Multiple usage patterns - helpers, static methods, or direct instantiation:
// Using helpers (define your own) $avatar = gravatar('email@example.com')->size(120); // Using static methods $avatar = Gravatar::image('email@example.com')->size(120); // Direct instantiation $avatar = new Image('email@example.com'); $avatar->size(120);
For more details, see the full documentation.
License
This library is licensed under the MIT license; you can find a full copy of the license itself in the file /LICENSE
forxer/gravatar 适用场景与选型建议
forxer/gravatar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 207.47k 次下载、GitHub Stars 达 29, 最近一次更新时间为 2014 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「gravatar」 「php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 forxer/gravatar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 forxer/gravatar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 forxer/gravatar 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A library providing easy gravatar integration/generation (Laravel supported).
Library to validate and parse social media profile URLs
Gravatar creator for Nette Framework
Gravel is a PHP library which provides easy access to get and display Gravatars.
Get Gravatar image URL and put by default an image with username initials, You can test this library here https://gravatar-url.herokuapp.com/examples/LibraryUse.php
Alfabank REST API integration
统计信息
- 总下载量: 207.47k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 35
- 点击次数: 11
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-02-19