PHPackages                             black-sheep-tech/laravel-ui-avatars - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. black-sheep-tech/laravel-ui-avatars

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

black-sheep-tech/laravel-ui-avatars
===================================

A simple service provider/wrapper for the UI Avatars API (https://ui-avatars.com).

v1.0.0(1y ago)3565MITPHPPHP ^8.0

Since Sep 2Pushed 1y ago2 watchersCompare

[ Source](https://github.com/BlackSheepTech/laravel-ui-avatars)[ Packagist](https://packagist.org/packages/black-sheep-tech/laravel-ui-avatars)[ RSS](/packages/black-sheep-tech-laravel-ui-avatars/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

 [ ![BlackSheepTech UiAvatars](https://avatars.githubusercontent.com/u/85756821?s=400&u=14843f72938dc40cbd14400f5b3daad45f054f43&v=4) ](https://github.com/BlackSheepTech/laravel-ui-avatars)

 [![Current Version](https://camo.githubusercontent.com/7f5121f583fa1ef3c2f5ccb3773f9b50f78d481a2f68dd39a66b74b57123e008/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626c61636b2d73686565702d746563682f6c61726176656c2d75692d61766174617273)](https://packagist.org/packages/black-sheep-tech/laravel-ui-avatars) [![Total Downloads](https://camo.githubusercontent.com/3c064c88f1930c3d94d8b8b4d9e0fa0af42eb1f03b7aff5d3858f9565541bcfa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626c61636b2d73686565702d746563682f6c61726176656c2d75692d61766174617273)](https://packagist.org/packages/black-sheep-tech/laravel-ui-avatars) [![License](https://camo.githubusercontent.com/a87eca3e6aaf92f8ec9c516ea17a23a3105c995d14c3c6cb725cadd4c3ff0341/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f426c61636b5368656570546563682f6c61726176656c2d75692d61766174617273)](https://packagist.org/packages/black-sheep-tech/laravel-ui-avatars) [![Stars](https://camo.githubusercontent.com/a434328519ae36528a8c35e08604aba8ba46a970e084af61bbef72a7c63fe7d1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f426c61636b5368656570546563682f6c61726176656c2d75692d61766174617273)](https://packagist.org/packages/black-sheep-tech/laravel-ui-avatars)

Laravel UiAvatars is a PHP library for Laravel used to generate avatar using the UI Avatars API (). 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.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require black-sheep-tech/laravel-ui-avatars
```

Usage
-----

[](#usage)

### Basic Usage / Url Generation

[](#basic-usage--url-generation)

```
use BlackSheepTech\UiAvatars\UiAvatars;

$avatarUrl = UiAvatars::make()
    ->name('John Doe')
    ->size(128)
    ->background('#ffffff')
    ->color('#000000')->getUrl();
```

### With all customizations

[](#with-all-customizations)

```
$avatarUrl = UiAvatars::make()
    ->name('John Doe')
    ->size(128)
    ->background('#ffffff')
    ->color('#000000')
    ->length(2)
    ->rounded(true)
    ->bold(true)
    ->uppercase(true)
    ->format('png')
    ->getUrl();
```

### Download Avatar

[](#download-avatar)

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

### Save Avatar Directly to Disk

[](#save-avatar-directly-to-disk)

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

Customization
-------------

[](#customization)

The `UiAvatarsService` class allows for various customizations:

- **name**: Sets the name from which the initials are generated.
- **background**: Sets the background color (hex code or 'random')(default: random).
- **color**: Sets the font color (hex code)(default: 8b5d5d).
- **size**: Sets the size of the avatar in pixels (16 to 512)(default: 64).
- **fontSize**: Sets the font size ratio (0.1 to 1.0)(default: 0.5).
- **length**: Sets the number of characters for initials (default: 2).
- **rounded**: Enables rounded avatars (default: false).
- **bold**: Enables bold text for initials (default: false).
- **uppercase**: Converts initials to uppercase (default: true).
- **format**: Sets the format of the avatar ('png' or 'svg')(default: png).

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- Laravel framework version 9.0 or higher

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request on GitHub.

Credits
-------

[](#credits)

- [Israel Pinheiro](https://github.com/IsraelPinheiro)
- [All Contributors](https://github.com/BlackSheepTech/laravel-ui-avatars/graphs/contributors)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

617d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f1bff44e900ea9254da31678986ec28a5894f29712b9af699cc52a4ddb77d32?d=identicon)[IsraelPinheiro](/maintainers/IsraelPinheiro)

---

Top Contributors

[![IsraelPinheiro](https://avatars.githubusercontent.com/u/2693283?v=4)](https://github.com/IsraelPinheiro "IsraelPinheiro (23 commits)")

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/black-sheep-tech-laravel-ui-avatars/health.svg)

```
[![Health](https://phpackages.com/badges/black-sheep-tech-laravel-ui-avatars/health.svg)](https://phpackages.com/packages/black-sheep-tech-laravel-ui-avatars)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
