A simple service provider/wrapper for the UI Avatars API (https://ui-avatars.com).
black-sheep-tech/laravel-ui-avatars is a Laravel package for a simple service provider/wrapper for the ui avatars api (https://ui-avatars.com)..
It currently has 3 GitHub stars and 567 downloads on Packagist (latest version v1.0.0).
Install it with composer require black-sheep-tech/laravel-ui-avatars.
Discover more Laravel packages by black-sheep-tech
or browse all Laravel packages to compare alternatives.
Last updated
Laravel UiAvatars is a PHP library for Laravel used to generate avatar using the UI Avatars API (https://laravel-ui-avatars.com). This package provides a simple, fluent interface for customizing avatar parameters and generating the corresponding URL. It also allows downloading and saving the avatars locally.
You can install the package via Composer:
composer require black-sheep-tech/laravel-ui-avatars
use BlackSheepTech\UiAvatars\UiAvatars;
$avatarUrl = UiAvatars::make()
->name('John Doe')
->size(128)
->background('#ffffff')
->color('#000000')->getUrl();
$avatarUrl = UiAvatars::make()
->name('John Doe')
->size(128)
->background('#ffffff')
->color('#000000')
->length(2)
->rounded(true)
->bold(true)
->uppercase(true)
->format('png')
->getUrl();
To download the avatar directly:
use BlackSheepTech\UiAvatars\UiAvatars;
// Prompts a download of the avatar to a file named 'john_doe_avatar.png', by default, if a file name is not provided, a random name will be generated.
UiAvatars::make()->name('John Doe')->download('john_doe_avatar');
To save the avatar to a specific location:
use BlackSheepTech\UiAvatars\UiAvatars;
// Saves the avatar to 'avatars/john_doe_avatar.png' by default.
$avatarPath = UiAvatars::make()->name('John Doe')->saveTo('avatars', 'john_doe_avatar');
// You can provided the disk to be used as the third parameter, by default, the application's default disk will be used.
$avatarPath = UiAvatars::make()->name('John Doe')->saveTo('avatars', 'john_doe_avatar', 'public');
The UiAvatarsService class allows for various customizations:
This package is open-sourced software licensed under the MIT license.
Contributions are welcome! Please feel free to submit a Pull Request on GitHub.