1. Go to this page and download the library: Download cable8mm/pretty-profile 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/ */
cable8mm / pretty-profile example snippets
use Cable8mm\PrettyProfile\PrettyProfile;
// Generate nickname
$nickname = PrettyProfile::getInstance()->nickname(12345);
// Output: "Happy Poodle" (example)
// Get dog image URL
$dogImage = PrettyProfile::getInstance()->dog(12345);
// Output: "https://cabinet-pets.palgle.com/avatars/dog/61.png"
// Get cat image URL (medium size)
$catImage = PrettyProfile::getInstance()->cat(12345, 'medium');
// Output: "https://cabinet-pets.palgle.com/avatars/cat/medium/13.png"
use Cable8mm\PrettyProfile\PrettyProfile;
// Get all dog images (original size)
$allDogs = PrettyProfile::getInstance()->dogs();
// Get all cat images (medium size)
$allCatsMedium = PrettyProfile::getInstance()->cats('medium');
// Generate preview
foreach ($allDogs as $index => $url) {
echo "\n";
}
use Cable8mm\PrettyProfile\PrettyProfile;
try {
// Invalid ID (0 or negative)
PrettyProfile::getInstance()->cat(0);
} catch (\InvalidArgumentException $e) {
echo $e->getMessage();
// "The value must be over 0, so a value of 0 is not valid."
}
try {
// Invalid size
PrettyProfile::getInstance()->dog(1, 'huge');
} catch (\InvalidArgumentException $e) {
echo $e->getMessage();
// "The value must be "large" or "medium" or "small", so a value of "huge" is not valid."
}
try {
// Invalid animal
PrettyProfile::profileImage(1, animal: 'rabbit');
} catch (\InvalidArgumentException $e) {
echo $e->getMessage();
// "The value must be dog or cat. rabbit is not valid."
}