esc-company/view-transformer

View Transformer make profile image or name if client's information is empty.

v2.2.0 2024-03-12 14:27 UTC

This package is auto-updated.

Last update: 2024-05-12 14:53:56 UTC


README

code-style run-tests Packagist Version Packagist Downloads Packagist Dependency Version Packagist Stars License: CC BY-NC-ND 4.0 Packagist License

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

Preview

Dog artworks

Dog 1 Dog 2 Dog 3 Dog 4 Dog 5 Dog 6 Dog 7 Dog 8 Dog 9 Dog 10 Dog 11 Dog 12 Dog 13 Dog 14 Dog 15 Dog 16 Dog 17 Dog 18 Dog 19 Dog 20 Dog 21 Dog 22 Dog 23 Dog 24 Dog 25 Dog 26 Dog 27 Dog 28 Dog 29 Dog 30 Dog 31 Dog 32 Dog 33 Dog 34 Dog 35 Dog 36 Dog 37 Dog 38 Dog 39 Dog 40 Dog 41 Dog 42 Dog 43 Dog 44 Dog 45 Dog 46 Dog 47 Dog 48 Dog 49 Dog 50 Dog 51 Dog 52 Dog 53 Dog 54 Dog 55 Dog 56 Dog 57 Dog 58 Dog 59 Dog 60 Dog 61 Dog 62 Dog 63 Dog 64 Dog 65 Dog 66 Dog 67 Dog 68 Dog 69 Dog 70 Dog 71 Dog 72 Dog 73 Dog 74 Dog 75 Dog 76 Dog 77 Dog 78 Dog 79 Dog 80

Cat artworks

Cat 1 Cat 2 Cat 3 Cat 4 Cat 5 Cat 6 Cat 7 Cat 8 Cat 9 Cat 10 Cat 11 Cat 12 Cat 13 Cat 14 Cat 15 Cat 16 Cat 17 Cat 18 Cat 19 Cat 20 Cat 21 Cat 22 Cat 23 Cat 24 Cat 25 Cat 26 Cat 27 Cat 28 Cat 29 Cat 30 Cat 31 Cat 32 Cat 33 Cat 34 Cat 35 Cat 36 Cat 37 Cat 38 Cat 39 Cat 40 Cat 41

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/