PHP code example of esc-company / view-transformer

1. Go to this page and download the library: Download esc-company/view-transformer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

esc-company / view-transformer example snippets


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');

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

print PrettyProfile::getInstance()->cat(1);
//=> https://cabinet.companimal.net/avatars/cat/1.png;

$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)...