An open API service indexing awesome lists of open source software.

https://github.com/cable8mm/view-transformer

View Transformer make profile image or name if client's information is empty.
https://github.com/cable8mm/view-transformer

api avatar cats dogs image php

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

          

# View Transformer

[![code-style](https://github.com/cable8mm/view-transformer/actions/workflows/code-style.yml/badge.svg)](https://github.com/cable8mm/view-transformer/actions/workflows/code-style.yml)
[![run-tests](https://github.com/cable8mm/view-transformer/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cable8mm/view-transformer/actions/workflows/run-tests.yml)
[![Packagist Version](https://img.shields.io/packagist/v/cable8mm/view-transformer)](https://packagist.org/packages/cable8mm/view-transformer)
[![Packagist Downloads](https://img.shields.io/packagist/dt/cable8mm/view-transformer)](https://packagist.org/packages/cable8mm/view-transformer/stats)
[![Packagist Dependency Version](https://img.shields.io/packagist/dependency-v/cable8mm/view-transformer/php)](https://packagist.org/packages/cable8mm/view-transformer)
[![Packagist Stars](https://img.shields.io/packagist/stars/cable8mm/view-transformer)](https://github.com/cable8mm/view-transformer/stargazers)
[![License: CC BY-NC-ND 4.0](https://img.shields.io/badge/License-CC_BY--NC--ND_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-nd/4.0/)
[![Packagist License](https://img.shields.io/packagist/l/cable8mm/view-transformer)](https://github.com/cable8mm/view-transformer/blob/main/LICENSE.md)

This API allows you to freely use names and images of dogs and cats without any limits. These images are hosted on [GitHub Pages](https://github.com/cable8mm/cabinet-pets) 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](https://creativecommons.org/licenses/by-nc-nd/4.0/?ref=chooser-v1). For more information, visit: .

We have provided the API Documentation on the web. For more information, please visit ❤️

## Features

- [x] 4,080 names for a dog or a cat without any limits
- [x] 81 images for a dog under [CC BY-NC-ND 4.0 license](https://creativecommons.org/licenses/by-nc-nd/4.0/?ref=chooser-v1)
- [x] 40 images for a cat under [CC BY-NC-ND 4.0 license](https://creativecommons.org/licenses/by-nc-nd/4.0/?ref=chooser-v1)

## Preview

### Dog artworks

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

### Cat artworks

![Cat 1](https://cabinet-pets.palgle.com/avatars/cat/medium/1.png)
![Cat 2](https://cabinet-pets.palgle.com/avatars/cat/medium/2.png)
![Cat 3](https://cabinet-pets.palgle.com/avatars/cat/medium/3.png)
![Cat 4](https://cabinet-pets.palgle.com/avatars/cat/medium/4.png)
![Cat 5](https://cabinet-pets.palgle.com/avatars/cat/medium/5.png)
![Cat 6](https://cabinet-pets.palgle.com/avatars/cat/medium/6.png)
![Cat 7](https://cabinet-pets.palgle.com/avatars/cat/medium/7.png)
![Cat 8](https://cabinet-pets.palgle.com/avatars/cat/medium/8.png)
![Cat 9](https://cabinet-pets.palgle.com/avatars/cat/medium/9.png)
![Cat 10](https://cabinet-pets.palgle.com/avatars/cat/medium/10.png)
![Cat 11](https://cabinet-pets.palgle.com/avatars/cat/medium/11.png)
![Cat 12](https://cabinet-pets.palgle.com/avatars/cat/medium/12.png)
![Cat 13](https://cabinet-pets.palgle.com/avatars/cat/medium/13.png)
![Cat 14](https://cabinet-pets.palgle.com/avatars/cat/medium/14.png)
![Cat 15](https://cabinet-pets.palgle.com/avatars/cat/medium/15.png)
![Cat 16](https://cabinet-pets.palgle.com/avatars/cat/medium/16.png)
![Cat 17](https://cabinet-pets.palgle.com/avatars/cat/medium/17.png)
![Cat 18](https://cabinet-pets.palgle.com/avatars/cat/medium/18.png)
![Cat 19](https://cabinet-pets.palgle.com/avatars/cat/medium/19.png)
![Cat 20](https://cabinet-pets.palgle.com/avatars/cat/medium/20.png)
![Cat 21](https://cabinet-pets.palgle.com/avatars/cat/medium/21.png)
![Cat 22](https://cabinet-pets.palgle.com/avatars/cat/medium/22.png)
![Cat 23](https://cabinet-pets.palgle.com/avatars/cat/medium/23.png)
![Cat 24](https://cabinet-pets.palgle.com/avatars/cat/medium/24.png)
![Cat 25](https://cabinet-pets.palgle.com/avatars/cat/medium/25.png)
![Cat 26](https://cabinet-pets.palgle.com/avatars/cat/medium/26.png)
![Cat 27](https://cabinet-pets.palgle.com/avatars/cat/medium/27.png)
![Cat 28](https://cabinet-pets.palgle.com/avatars/cat/medium/28.png)
![Cat 29](https://cabinet-pets.palgle.com/avatars/cat/medium/29.png)
![Cat 30](https://cabinet-pets.palgle.com/avatars/cat/medium/30.png)
![Cat 31](https://cabinet-pets.palgle.com/avatars/cat/medium/31.png)
![Cat 32](https://cabinet-pets.palgle.com/avatars/cat/medium/32.png)
![Cat 33](https://cabinet-pets.palgle.com/avatars/cat/medium/33.png)
![Cat 34](https://cabinet-pets.palgle.com/avatars/cat/medium/34.png)
![Cat 35](https://cabinet-pets.palgle.com/avatars/cat/medium/35.png)
![Cat 36](https://cabinet-pets.palgle.com/avatars/cat/medium/36.png)
![Cat 37](https://cabinet-pets.palgle.com/avatars/cat/medium/37.png)
![Cat 38](https://cabinet-pets.palgle.com/avatars/cat/medium/38.png)
![Cat 39](https://cabinet-pets.palgle.com/avatars/cat/medium/39.png)
![Cat 40](https://cabinet-pets.palgle.com/avatars/cat/medium/40.png)
![Cat 41](https://cabinet-pets.palgle.com/avatars/cat/medium/41.png)

## Installation

```sh
composer require cable8mm/view-transformer
```

## Usage

### APIs

The number 393939 would be better utilized as a user ID.

```php
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.

```php
use Cable8mm\ViewTransformer\PrettyProfile;

print PrettyProfile::getInstance()->nickname(1)
//=> 평범한 네벨룽;
```

```php
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:

```blade
{{ PrettyProfileHelper::profileImage(4123, animal:'dog') }}
{{-- ==> https://cabinet-pets.palgle.com/avatars/dog/43.png --}}
```

Preview can be generated using the following code:

```php
use Cable8mm\ViewTransformer\PrettyProfile;

$dogs = PrettyProfile::getInstance()->dogs('medium');

array_map(
fn($item, $key) => print '![Dog '.$key.']('.$item.')'.PHP_EOL,
$dogs,
array_keys($dogs)
);
//=> ![Dog 1](https://cabinet-pets.palgle.com/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-pets.palgle.com/avatars/cat/1.png)...
```

## Formatting

```bash
composer lint
# Modify all files to comply with the PSR-12.

composer inspect
# Inspect all files to ensure compliance with PSR-12.
```

## Test

```sh
composer test
```

## License

The View Transformer project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

[Artworks](https://github.com/cable8mm/cabinet-pets) © 2020 by [Samgu Lee](https://github.com/cable8mm) is licensed under CC BY-NC-ND 4.0. To view a copy of this license, visit