PHPackages                             tequilarapido/letter-avatar - 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. tequilarapido/letter-avatar

ActiveLibrary

tequilarapido/letter-avatar
===========================

Provide a simple way to create letter avatar images, like those in your Gmail inbox

1.0.1(10y ago)1218.8k↓100%7[2 PRs](https://github.com/tequilarapido/letter-avatar/pulls)MITPHPPHP &gt;=5.4.0

Since Apr 26Pushed 8y ago4 watchersCompare

[ Source](https://github.com/tequilarapido/letter-avatar)[ Packagist](https://packagist.org/packages/tequilarapido/letter-avatar)[ RSS](/packages/tequilarapido-letter-avatar/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

Letter Avatar
=============

[](#letter-avatar)

Provide a simple way to create letter avatar images, like those in your Gmail inbox.

Install
-------

[](#install)

```
composer require "tequilarapido/letter-avatar"

```

Usage
-----

[](#usage)

### Generate a letter avatar

[](#generate-a-letter-avatar)

```
$letterAvatar = new LetterAvatar\LetterAvatar;

$letterAvatar
	->generate('A', 40)
	->saveAsPng('/path/to/file.png');

# You can pass a string, the first letter will be picked

$letterAvatar
	->generate($user->getFirstName(), 40)
	->saveAsPng('/path/to/file.png');

# If you don't specify a size, the max size will be used (240 by default)

```

### Custom font

[](#custom-font)

The font used by default is Open Sans Regular from google font. If you want, you can use any TTF font by setting the font file full path like so :

```
$letterAvatar
    ->setFontFile('path/to/ttf_file.ttf')
    ->generate('B', 40)
    ->saveAsPng('/path/to/file.png');

```

### Save as jpeg

[](#save-as-jpeg)

```
$letterAvatar
	->generate('J')
	->saveAsJpeg('/path/to/file.jpg');

```

### Save as png

[](#save-as-png)

```
$letterAvatar
	->generate('J')
	->saveAsPng('/path/to/file.png');

```

### Text color

[](#text-color)

```
$letterAvatar
	->setTextColor([255, 0, 0])
	->generate('J')
	->saveAsJpeg('/path/to/file.jpg');

```

### Text shadow

[](#text-shadow)

```
$letterAvatar
	->setTextColor([255, 0, 0])
	->generate('J')
	->showTextShadow(false)
	->saveAsJpeg('/path/to/file.jpg');

```

### Background colors palette

[](#background-colors-palette)

```
$letterAvatar
	->setBackgroundColors([[255, 0, 0], [0, 255, 0], [0, 0, 255]])
	->generate('J')
	->saveAsJpeg('/path/to/file.jpg');

```

### Using the same background color

[](#using-the-same-background-color)

You can chain multiple generation to keep the same background color. (Generating multiple sizes)

```
$letterAvatar
	->generate('J', 50)->saveAsJpeg('/path/to/50x50/file.jpg')
	->generate('J', 100)->saveAsJpeg('/path/to/100x100/file.jpg');

```

### Reset background color

[](#reset-background-color)

If you want you can reset background color (so that a new random one will be used) in the middle of chaining

```
$letterAvatar
	->generate('J', 50)->saveAsJpeg('/path/to/50x50/file.jpg')
	->generate('J', 100)->saveAsJpeg('/path/to/100x100/file.jpg')
    ->resetBackgroundColor()
    ->generate('C', 100)->saveAsJpeg('/path/to/100x100/file.jpg');

```

###  Health Score

35

↑

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% 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

Every ~0 days

Total

2

Last Release

3983d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2357415d73716a023601d0bc95812c5160ff977f17da9d43fbdc40b047a05c50?d=identicon)[nbourguig](/maintainers/nbourguig)

---

Top Contributors

[![nbourguig](https://avatars.githubusercontent.com/u/276832?v=4)](https://github.com/nbourguig "nbourguig (4 commits)")[![oprog](https://avatars.githubusercontent.com/u/3731303?v=4)](https://github.com/oprog "oprog (3 commits)")

---

Tags

generatoravatarletter

### Embed Badge

![Health badge](/badges/tequilarapido-letter-avatar/health.svg)

```
[![Health](https://phpackages.com/badges/tequilarapido-letter-avatar/health.svg)](https://phpackages.com/packages/tequilarapido-letter-avatar)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k108.7M496](/packages/symfony-maker-bundle)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k26.8M78](/packages/simplesoftwareio-simple-qrcode)[multiavatar/multiavatar-php

Multicultural Avatar Generator

653145.1k3](/packages/multiavatar-multiavatar-php)[phpowermove/docblock

PHP Docblock parser and generator. An API to read and write Docblocks.

2522.9M4](/packages/phpowermove-docblock)[tomloprod/radiance

A deterministic mesh gradient avatar generator for PHP.

1282.0k](/packages/tomloprod-radiance)

PHPackages © 2026

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