gigadrive / minecraft-avatar-urls
轻松生成Minecraft头像的URL,并能轻松切换服务
1.0.0
2021-09-12 17:56 UTC
Requires
- php: ^7.1 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-13 00:36:05 UTC
README
此库提供了PHP工具,用于生成不同格式的Minecraft头像URL,并能轻松在头像服务之间切换。
要求
- PHP 7.1或更高版本
- Composer
安装
composer require gigadrive/minecraft-avatar-urls
使用方法
use Gigadrive\MinecraftAvatar\MinecraftAvatar; // Set default service to use MinecraftAvatar::setDefaultService(MinecraftAvatar::SERVICE_MINOTAR); // minotar.net MinecraftAvatar::setDefaultService(MinecraftAvatar::SERVICE_CRAFATAR); // crafatar.com MinecraftAvatar::setDefaultService(MinecraftAvatar::SERVICE_CRAFTHEAD); // crafthead.net MinecraftAvatar::setDefaultService(MinecraftAvatar::SERVICE_MCHEADS); // mc-heads.net MinecraftAvatar::setDefaultService(MinecraftAvatar::SERVICE_CRAVATAR); // cravatar.eu // Retrieve the default service class $service = MinecraftAvatar::getDefaultService(); // Retrieve the default service class through global function $service = avatar(); // Manually retrieve a service class $service = MinecraftAvatar::getServices()[MinecraftAvatar::SERVICE_MINOTAR]; // minotar.net $service = MinecraftAvatar::getServices()[MinecraftAvatar::SERVICE_CRAFATAR]; // crafatar.com $service = MinecraftAvatar::getServices()[MinecraftAvatar::SERVICE_CRAFTHEAD]; // crafthead.net $service = MinecraftAvatar::getServices()[MinecraftAvatar::SERVICE_MCHEADS]; // mc-heads.net $service = MinecraftAvatar::getServices()[MinecraftAvatar::SERVICE_CRAVATAR]; // cravatar.eu // Use service class // Not all formats are available on all classes, check their websites for documentation // Functions include phpDoc blocks. $service->face("73b417dcd1e645d8af06895eeb5222a5", 16, true); // Returns a URL 16x16 face image of a player including the helm layer
版权和许可
本程序由Mehdi Baaboura开发并由Gigadrive UG发布,采用MIT许可。更多信息请点击此处。