cable8mm / view-transformer
View Transformer make profile image or name if client's information is empty.
Requires
- php: ^8.0
Requires (Dev)
- laravel/pint: ^1.0
- phpunit/phpunit: ^9.0|^10.0|^11.0
README
This API allows you to freely use names and images of dogs and cats without any limits. These images are hosted on GitHub Pages with the domain cabinet-pets.palgle.com. Additionally, WordPress contents can be converted to HTML, including YouTube embed tags.
This repository is licensed under the MIT license, and the artworks are licensed under the CC BY-NC-ND 4.0 license. For more information, visit: https://github.com/cable8mm/cabinet-pets.
We have provided the API Documentation on the web. For more information, please visit https://palgle.com/view-transformer/ ❤️
Features
- 4,080 names for a dog or a cat without any limits
- 81 images for a dog under CC BY-NC-ND 4.0 license
- 40 images for a cat under CC BY-NC-ND 4.0 license
Preview
Dog artworks
Cat artworks
Installation
composer require cable8mm/view-transformer
Usage
APIs
The number 393939 would be better utilized as a user ID.
use Cable8mm\ViewTransformer\PrettyProfile; 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');
Various cases
It has been designed to retrieve an image by user ID, even if the ID is a large number.
use Cable8mm\ViewTransformer\PrettyProfile; print PrettyProfile::getInstance()->nickname(1) //=> 평범한 네벨룽;
use Cable8mm\ViewTransformer\PrettyProfile; print PrettyProfile::getInstance()->cat(1); //=> https://cabinet-pets.palgle.com/avatars/cat/1.png;
You can use it as follows in Laravel Blade:
{{ PrettyProfileHelper::profileImage(4123, animal:'dog') }} {{-- ==> https://cabinet-pets.palgle.com/avatars/dog/43.png --}}
Preview can be generated using the following code:
use Cable8mm\ViewTransformer\PrettyProfile; $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) ); //=> ...
Formatting
composer lint # Modify all files to comply with the PSR-12. composer inspect # Inspect all files to ensure compliance with PSR-12.
Test
composer test
License
The View Transformer project is open-sourced software licensed under the MIT license.
Artworks © 2020 by Samgu Lee is licensed under CC BY-NC-ND 4.0. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/