esc-company / view-transformer
如果客户端信息为空,View Transformer会显示头像或名称。
v2.2.0
2024-03-12 14:27 UTC
Requires
- php: ^8.0
Requires (Dev)
- laravel/pint: ^1.0
- phpunit/phpunit: ^9.0|^10.0|^11.0
README
此API允许您自由使用狗和猫的名称和图片,没有任何限制。这些图片托管在GitHub Pages上,域名是cabinet.companimal.net。此外,WordPress内容可以转换为HTML,包括YouTube嵌入标签。
此仓库采用MIT许可证,艺术品采用CC BY-NC-ND 4.0许可证。更多信息,请访问:https://github.com/companimal/cabinet。
我们已在网站上提供了API文档。更多信息,请访问https://www.companimal.net/view-transformer/ ❤️
功能
- 无限制的4,080个狗或猫的名称
- 81个狗的图片,受CC BY-NC-ND 4.0许可证保护
- 40个猫的图片,受CC BY-NC-ND 4.0许可证保护
预览
狗艺术品
猫艺术品
安装
composer require esc-company/view-transformer
用法
API
数字393939最好用作用户ID。
PrettyProfile::getInstance()->nickname(393939) // get a nickname. print PrettyProfile::getInstance()->cat(393939); print PrettyProfile::getInstance()->cat(393939, 'large'); // The second argument can be 'large', 'medium', or 'small'. Null indicates the original size. print PrettyProfile::getInstance()->dog(393939); print PrettyProfile::getInstance()->dog(393939, 'large'); print PrettyProfile::getInstance()->cats(); // All cat images print PrettyProfile::getInstance()->cats('medium'); // All cat images in medium size print PrettyProfile::getInstance()->dogs(); print PrettyProfile::getInstance()->dogs('medium');
各种情况
它已被设计为通过用户ID检索图片,即使ID是大型数字。
print PrettyProfile::getInstance()->nickname(1) //=> 평범한 네벨룽;
print PrettyProfile::getInstance()->cat(1); //=> https://cabinet.companimal.net/avatars/cat/1.png;
您可以在Laravel Blade中如下使用它:
{{ PrettyProfileHelper::profileImage(4123, animal:'dog') }} {{-- ==> https://cabinet.companimal.net/avatars/dog/43.png --}}
可以使用以下代码生成预览:
$dogs = PrettyProfile::getInstance()->dogs('medium'); array_map( fn($item, $key) => print ''.PHP_EOL, $dogs, array_keys($dogs) ); //=> ... $cats = PrettyProfile::getInstance()->cats('medium'); array_map( fn($item, $key) => print ''.PHP_EOL, $cats, array_keys($cats) ); //=> ...
格式化
composer lint # Modify all files to comply with the PSR-12. composer inspect # Inspect all files to ensure compliance with PSR-12.
测试
composer test
许可证
View Transformer项目是开源软件,采用MIT许可证。
艺术品 © 2020由Companimal提供,受CC BY-NC-ND 4.0许可证保护。要查看此许可证的副本,请访问http://creativecommons.org/licenses/by-nc-nd/4.0/