esc-company / 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.companimal.net. 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/companimal/cabinet.
We have provided the API Documentation on the web. For more information, please visit https://www.companimal.net/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 esc-company/view-transformer
Usage
APIs
The number 393939 would be better utilized as a user 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');
Various cases
It has been designed to retrieve an image by user ID, even if the ID is a large number.
print PrettyProfile::getInstance()->nickname(1) //=> 평범한 네벨룽;
print PrettyProfile::getInstance()->cat(1); //=> https://cabinet.companimal.net/avatars/cat/1.png;
You can use it as follows in Laravel Blade:
{{ PrettyProfileHelper::profileImage(4123, animal:'dog') }} {{-- ==> https://cabinet.companimal.net/avatars/dog/43.png --}}
Preview can be generated using the following code:
$dogs = PrettyProfile::getInstance()->dogs('medium'); array_map( fn($item, $key) => print '![Dog '.$key.']('.$item.')'.PHP_EOL, $dogs, array_keys($dogs) ); //=> ![Dog 1](https://cabinet.companimal.net/avatars/dog/1.png)... $cats = PrettyProfile::getInstance()->cats('medium'); array_map( fn($item, $key) => print '![Cat '.$key.']('.$item.')'.PHP_EOL, $cats, array_keys($cats) ); //=> ![Cat 1](https://cabinet.companimal.net/avatars/cat/1.png)...
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 Companimal 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/