PHPackages                             kikter/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. kikter/avatars

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

kikter/avatars
==============

Official Laravel wrapper around avatars.com and LasseRafn/php-initial-avatar-generator

00PHP

Since Oct 31Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Temian1/kik-avatar)[ Packagist](https://packagist.org/packages/kikter/avatars)[ RSS](/packages/kikter-avatars/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Official Laravel wrapper for
=====================================================

[](#official-laravel-wrapper-for-httpsui-avatarscom)

 [![Build Status](https://camo.githubusercontent.com/c4267b6fed5d73636e358e07c2b75a344191452178192adb241837fd77c02d5a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5261636b626561742f6c61726176656c2d75692d617661746172732e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Rackbeat/laravel-ui-avatars)[![Coverage](https://camo.githubusercontent.com/cfd0fc1c40e636e0be7951e33ec3d88adf2ac444bf84d1b4da7dacff6aa5ee61/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f5261636b626561742f6c61726176656c2d75692d617661746172732e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/Rackbeat/laravel-ui-avatars)[![Total Downloads](https://camo.githubusercontent.com/47055569671f5663291b2a9e46672fcad72ae4c60a2b298389461b7f662f4871/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7261636b626561742f6c61726176656c2d75692d617661746172732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rackbeat/laravel-ui-avatars)[![Latest Stable Version](https://camo.githubusercontent.com/92f0aeef4eaeaea2ee288922cadcaaa09bc1a3938499fb4407851cf3b49ef029/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7261636b626561742f6c61726176656c2d75692d617661746172732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rackbeat/laravel-ui-avatars)[![License](https://camo.githubusercontent.com/c9908fa3cb4648ac57c749371cb19a7b921fcf467e720ac5c75a9f15ad2b116c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7261636b626561742f6c61726176656c2d75692d617661746172732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rackbeat/laravel-ui-avatars)

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

[](#installation)

You just require using composer and you're good to go!

```
composer require rackbeat/laravel-ui-avatars
```

The Service Provider is automatically registered.

Setup
-----

[](#setup)

To setup the config file, you publish it like so:

```
php artisan vendor:publish --provider="Rackbeat\UIAvatars\UIAvatarsServiceProvider"
```

You can edit the file in `config/ui-avatars.php`.

Usage
-----

[](#usage)

### 1. Add the `Rackbeat\UIAvatars\HasAvatar` trait to your Model (e.g. `App\Users`)

[](#1-add-the-rackbeatuiavatarshasavatar-trait-to-your-model-eg-appusers)

```
// ...
class User extends Authenticatable {
  use \Rackbeat\UIAvatars\HasAvatar;
  // ...
}
```

### 2. Create a new method on your Model.

[](#2-create-a-new-method-on-your-model)

This method is practically a proxy to call the `HasAvatar` methods. It will return a gravatar from the e-mail, with a fallback to the avatar using `ui-avatars.com` API.

```
public function getAvatar( $size = 64 ) {
  return $this->getGravatar( $this->email, $size );
}
```

NOTICE: Gravatar is only available using the API, not locally generated avatars.

### 3. (Optional) Re-define the name field

[](#3-optional-re-define-the-name-field)

Assuming you're not using the default `User` Model in Laravel, you can override which field is being used for the name.

```
public function getAvatarNameKey( ) {
  return 'full_name';
}
```

Available methods
-----------------

[](#available-methods)

### `getInitials($length=null)`

[](#getinitialslengthnull)

Returns the generated initials, from the name, used in the avatar.

Default `$length` can be defined in `config/ui-avatars.php` (`length` key)

### `getUrlfriendlyAvatar($size=null)`

[](#geturlfriendlyavatarsizenull)

Return a urlfriendly formatted avatar (URL or base64).

Example usage:

```

```

Default `$size` can be defined in `config/ui-avatars.php` (`image_size` key)

### `getAvatarBase64($size=null)`

[](#getavatarbase64sizenull)

Return a base64 representation of the avatar.

Default `$size` can be defined in `config/ui-avatars.php` (`image_size` key)

### `getAvatarImage($size=null)`

[](#getavatarimagesizenull)

Return a Image object of the avatar.

Default `$size` can be defined in `config/ui-avatars.php` (`image_size` key)

### `getGravatar($email, $size=null)`

[](#getgravataremail-sizenull)

Return a link to a Gravatar image using the specified email, and a fallback to using our own generator (assuming provider = `api`)

Default `$size` can be defined in `config/ui-avatars.php` (`image_size` key)

Available options
-----------------

[](#available-options)

In the config file you can specify different options.

KeyDescriptionDefaultAvailable Options / TypeproviderWhich provider to use for generating avatars.`api``local` or `api`lengthMax initials length (amount of letters)`2`Number, min: 1, max: unlimitedimage\_sizeDefault width &amp; height for the generated avatar.`48`Number, min: 1, max: unlimited (512 using `api` provider)font\_sizeFont size in percentage of `image_size`.`0.5`Number, min: 0, max: 1roundedShould the generated avatar be a rounded circle? (its recommended to disable and round using CSS)`false`Booleansmooth\_roundingIf `rounded` is enabled, and provider is `local`, you can enable smoother rounding with the cost of performance.`true`BooleanuppercaseShould the initials be forced uppercase or not.`true`Booleanbackground\_colorDefault HEX background color for avatars.`#a0a0a0`Hexfont\_colorDefault HEX font color for avatars.`#222`HexprovidersList of available providers. For you to add your own provider.Array of providersRequirements
------------

[](#requirements)

- PHP &gt;= 7.1

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d5332b731e1d74292dd2514693df159822027cdea967e29ce79206d3e5d97d17?d=identicon)[Kikismedia](/maintainers/Kikismedia)

---

Top Contributors

[![Temian1](https://avatars.githubusercontent.com/u/39234980?v=4)](https://github.com/Temian1 "Temian1 (1 commits)")

### Embed Badge

![Health badge](/badges/kikter-avatars/health.svg)

```
[![Health](https://phpackages.com/badges/kikter-avatars/health.svg)](https://phpackages.com/packages/kikter-avatars)
```

###  Alternatives

[teguh02/indonesia-territory-forms

Display a Indonesia Territory Select Form For Filament Within the Zip-Code Without Any Seeder Needed

161.1k](/packages/teguh02-indonesia-territory-forms)

PHPackages © 2026

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