Download the PHP package cable8mm/pretty-profile without Composer
On this page you can find all versions of the php package cable8mm/pretty-profile. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pretty-profile
Pretty Profile
A PHP library for generating pet (dog/cat) avatar images and nicknames. Provides consistent profile defaults based on user IDs.
Features
- 4,080 dog/cat nicknames (breed names + descriptive adjectives)
- 80 dog avatar images
- 41 cat avatar images
- 3 image sizes supported (large, medium, small)
- Laravel Blade support
- Deterministic algorithm (same ID always returns same result)
- Configurable avatar base URL in Laravel
Installation
Laravel configuration
The default avatar base URL is https://cabinet-pets.palgle.com/avatars. To use
another host or path, set the following environment variable:
The configuration can also be published with:
Quick Start
API Reference
PrettyProfile
Generates nicknames and pet image URLs based on user ID.
Methods
nickname(int $id): string
Generates a nickname from user ID.
Parameters:
$id(int): User ID (must be >= 1)
Returns: Adjective + breed name combination (e.g., "Ordinary Nebelung")
Throws: InvalidArgumentException - If ID is 0 or negative
Example:
cat(int $id, ?string $size = null): string
Returns a cat image URL.
Parameters:
$id(int): User ID (must be >= 1)$size(string|null): 'large', 'medium', 'small', or null (original size)
Returns: Image URL
Throws: InvalidArgumentException - If ID is invalid or size is not valid
Example:
dog(int $id, ?string $size = null): string
Returns a dog image URL.
Parameters:
$id(int): User ID (must be >= 1)$size(string|null): 'large', 'medium', 'small', or null (original size)
Returns: Image URL
Throws: InvalidArgumentException - If ID is invalid or size is not valid
Example:
cats(?string $size = null): array
Returns array of all cat image URLs.
Parameters:
$size(string|null): 'large', 'medium', 'small', or null (original size)
Returns: Array of image URLs (41 items)
Example:
dogs(?string $size = null): array
Returns array of all dog image URLs.
Parameters:
$size(string|null): 'large', 'medium', 'small', or null (original size)
Returns: Array of image URLs (80 items)
Example:
profileImage(int $id, ?string $image = null, string $animal = 'dog'): string
Helper method for Laravel Blade templates.
Parameters:
$id(int): User ID$image(string|null): Custom image URL (used if provided)$animal(string): 'dog' or 'cat' (default: 'dog')
Returns: Image URL
Throws: InvalidArgumentException - If animal is not 'dog' or 'cat'
Example:
backgroundImage(?string $background_image = null): string
Returns a background image URL.
Parameters:
$background_image(string|null): Custom background image URL
Returns: Background image URL
Example:
Usage Examples
Generate User Profile Images
Get All Images
Laravel Blade Integration
Exception Handling
Algorithm
Image Selection Algorithm
Uses the remainder of dividing user ID by the number of images. This ensures:
- Deterministic: Same ID always returns the same image
- Uniform distribution: If IDs are evenly distributed, images are evenly distributed
- Unlimited: Works correctly even if ID exceeds image count
Nickname Generation Algorithm
Selects prefix (adjective) and suffix (breed name) independently using modular arithmetic.
Preview
Dog artworks
![]()
Cat artworks
![]()
Formatting
Test
License
The Pretty Profile project is open-sourced software licensed under the MIT license.
Artworks © 2020 by Samgu Lee 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/