PHPackages                             fabian-tomischka/php-avatar-generator - 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. fabian-tomischka/php-avatar-generator

AbandonedArchivedLibrary

fabian-tomischka/php-avatar-generator
=====================================

Easily create user avatars based on provided names or strings

41.3k↓100%2PHP

Since Aug 28Pushed 7y agoCompare

[ Source](https://github.com/fabian-tomischka/php-avatar-generator)[ Packagist](https://packagist.org/packages/fabian-tomischka/php-avatar-generator)[ RSS](/packages/fabian-tomischka-php-avatar-generator/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

fabian-tomischka/php-avatar-generator
=====================================

[](#fabian-tomischkaphp-avatar-generator)

Display unique avatars based on the initials of your users names. Easy to use with loads of options to extend by yourself.

[![Images](https://camo.githubusercontent.com/fd147426a58feee6e8f32016976e8a2241fd3797d9117cfcd999340d3caf3d41/68747470733a2f2f692e696d6775722e636f6d2f54495a3773426d2e6a7067)](https://camo.githubusercontent.com/fd147426a58feee6e8f32016976e8a2241fd3797d9117cfcd999340d3caf3d41/68747470733a2f2f692e696d6775722e636f6d2f54495a3773426d2e6a7067)

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

[](#installation)

Require from composer and start using it!

```
composer require fabian-tomischka/php-avatar-generator
```

Usage
-----

[](#usage)

Quick-start with a simple line of code

```
use Fabito\AvatarGenerator\Avatar;

$generator = new Avatar();
$avatar = $generator->name('Fabian Tomischka')->toJpeg();
```

You can also use a string instead of a given name. However, when providing a string, it will ignore any given whitespaces and always take the characters from the string directly.

```
// Will result in Fa on the avatar instead of FT
$avatar = $generator->string('Fabian Tomischka')->toJpeg();
```

You can also access the image manager or canvas of the underlying Intervention/Image in case you need it

```
$manager = $generator->getImageManager();
$canvas = $generator->name('Fabian Tomischka')->getImageCanvas();
```

Customizing
-----------

[](#customizing)

The package offers multiple ways of adjusting and tweaking the settings.

**driver(*'driver'*)**

The driver which is used for generating the images. Currently supported: gd and imagick. Default: gd

```
$avatar = $generator->driver($generator::DRIVER_IMAGICK)->toBase64();
```

**height(*'px'*), width(*'px'*), size(*'px'*), dimensions(*'width', 'height'*)**

Change the dimensions of the avatar. Usually size will do the job. Default: 100px

```
$avatar = $generator->size(100)->toBase64();
```

**backgroundColor(*'color'*)**

In case you do not want to use the default colors provided by the package you can manually set the color here

```
$avatar = $generator->backgroundColor('#000000')->toBase64();
```

**fontColor(*'color'*)**

Change the font color. Default: #F7F7F7

```
$avatar = $generator->fontColor('#000000')->toBase64();
```

**fontSize(*'px'*)**

Change the font size on the avatar. Default: 42px

```
$avatar = $generator->fontSize(42)->toBase64();
```

**length(*'int'*)**

In case you require less or more characters to be on the avatar. Default: 2

```
// Output: F
$avatar = $generator->name('Fabian Tomischka')->length(1)->toBase64();
$avatar = $generator->string('FT')->length(1)->toBase64();
```

Loading custom fonts
--------------------

[](#loading-custom-fonts)

By default, the package comes with pre-installed OpenSans Light and Regular fonts. They usually do the job. In case you want to change your font, you can do that by calling the font method and providing a path to the new font:

```
$avatar = $generator->font('/dir/to/the/font.ttf')->name('Fabian Tomischka')->toBase64();
```

Make sure that the font is available as TTF!

Getting image data
------------------

[](#getting-image-data)

For easy access the package offers multiple direct methods to access the image in different file formats.

```
$avatar = $generator->name('Fabian Tomischka')->toBase64(); // Base 64
$avatar = $generator->name('Fabian Tomischka')->toPng(); // PNG
$avatar = $generator->name('Fabian Tomischka')->toJpeg(); // JPEG
$avatar = $generator->name('Fabian Tomischka')->toWebp; // WebP
```

As mentioned above, in case you need access to the underlying manager or image, you can access them via

```
$manager = $generator->getImageManager();
$canvas = $generator->name('Fabian Tomischka')->getImageCanvas();
```

Rounded avatars
---------------

[](#rounded-avatars)

The package potentially offers you an option to generate rounded avatars.

```
$avatar = $generator->rounded()->name('Fabian Tomischka')->toBase64();
```

However I do highly suggest using border radius in CSS to display your avatar as a circle. Generating rounded avatars will always result in a lower quality.

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

[](#requirements)

- PHP 7.1.7 or higher
- Intervention/Image 2.4 or higher
- Imagick extension (in case you do not use the default GD)

###  Health Score

24

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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/a7d6fc47377b5c93379a17b02492528721d9fd5ec1ab7bf81208efffb14666fa?d=identicon)[Fabito](/maintainers/Fabito)

---

Top Contributors

[![fabiantomischka](https://avatars.githubusercontent.com/u/22061079?v=4)](https://github.com/fabiantomischka "fabiantomischka (6 commits)")

---

Tags

avataravatar-generatorimagickinterventionphp

### Embed Badge

![Health badge](/badges/fabian-tomischka-php-avatar-generator/health.svg)

```
[![Health](https://phpackages.com/badges/fabian-tomischka-php-avatar-generator/health.svg)](https://phpackages.com/packages/fabian-tomischka-php-avatar-generator)
```

PHPackages © 2026

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