PHPackages                             astrotomic/php-unavatar - 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. astrotomic/php-unavatar

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

astrotomic/php-unavatar
=======================

PHP integration of unavatar service.

0.3.0(3y ago)912.6k↓53.8%[1 PRs](https://github.com/Astrotomic/php-unavatar/pulls)1MITPHPPHP ^7.4 || ^8.0

Since Feb 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Astrotomic/php-unavatar)[ Packagist](https://packagist.org/packages/astrotomic/php-unavatar)[ Docs](https://astrotomic.info)[ Fund](https://forest.astrotomic.info)[ GitHub Sponsors](https://github.com/Gummibeer)[ RSS](/packages/astrotomic-php-unavatar/feed)WikiDiscussions main Synced yesterday

READMEChangelog (4)Dependencies (1)Versions (6)Used By (1)

PHP Unavatar
============

[](#php-unavatar)

[![Latest Version](https://camo.githubusercontent.com/64f92845ec583bcd45c735d51f15dc351c5432f60a8eb76b25d91fc64a227800/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617374726f746f6d69632f7068702d756e6176617461722e7376673f6c6162656c3d52656c65617365267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/astrotomic/php-unavatar)[![MIT License](https://camo.githubusercontent.com/d0149caf29f30ea0a649dd35708d0eae3a25785e5ca3f1b8d8664afb968b8c1b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f417374726f746f6d69632f7068702d756e6176617461722e7376673f6c6162656c3d4c6963656e736526636f6c6f723d626c7565267374796c653d666f722d7468652d6261646765)](https://github.com/Astrotomic/php-unavatar/blob/master/LICENSE)[![Offset Earth](https://camo.githubusercontent.com/d204555ebe1fb0ae82d10c97b4f4ffc2dfdd2ba1489f98be7f7e8708333a0466/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d677265656e3f7374796c653d666f722d7468652d6261646765)](https://offset.earth/treeware)[![Larabelles](https://camo.githubusercontent.com/a2c8d5126ddd8c5ddc627176d1d2e0568f8399b50038e71fd7f774c3e24dbe4b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726162656c6c65732d2546302539462541362538342d6c6967687470696e6b3f7374796c653d666f722d7468652d6261646765)](https://www.larabelles.com/)

[![GitHub Workflow Status](https://camo.githubusercontent.com/9b78987ae13459af01426ce762e7aa39cfa8ac51d60e1fa9a1351c6ad424c9a0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f417374726f746f6d69632f7068702d756e6176617461722f72756e2d74657374733f7374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562266c6162656c3d5465737473)](https://github.com/Astrotomic/php-unavatar/actions?query=workflow%3Arun-tests)[![StyleCI](https://camo.githubusercontent.com/b339245b73176145d3a6bec98a3ab4a1d64145a89983da4510dd668f81c4507a/68747470733a2f2f7374796c6563692e696f2f7265706f732f3234323233363436382f736869656c64)](https://styleci.io/repos/242236468)[![Total Downloads](https://camo.githubusercontent.com/e73a3beb59a4880dd79ed187fd5228be9a04825913c86a3ea46d1654104a711f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617374726f746f6d69632f7068702d756e6176617461722e7376673f6c6162656c3d446f776e6c6f616473267374796c653d666c61742d737175617265)](https://packagist.org/packages/astrotomic/php-unavatar)

This package provides a PHP OOP builder for [unavatar](https://unavatar.now.sh).

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

[](#installation)

You can install the package via composer:

```
composer require astrotomic/php-unavatar
```

Usage
-----

[](#usage)

To create an `Unavatar` instance you can simply create one or use one of the static helper methods. Please refer to the [unavatar docs](https://unavatar.now.sh/) for a full documentation of possibilities.

```
use Astrotomic\Unavatar\Unavatar;

$unavatar = new Unavatar('email@example.com');
Unavatar::email('email@example.com');
Unavatar::username('Astrotomic');
Unavatar::domain('astrotomic.info');
Unavatar::github('Astrotomic');
```

### Fallback

[](#fallback)

You can also add a fallback image URL that's used if no image is found.

```
$unavatar->fallback('https://example.com/image.jpg');
```

### URL

[](#url)

You can call `toUrl()` on your `Unavatar` instance to retrieve the full generated URL.

```
$unavatar->toUrl();
```

```
https://unavatar.now.sh/email%40example.com/?fallback=https%3A%2F%2Fexample.com%2Fimage.jpg

```

### HTML img-tag

[](#html-img-tag)

You can also call `toImg()` on your `Unavatar` instance to get a full HTML `` tag.

```
$unavatar->toImg(['loading' => 'lazy']);
```

```

```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/Astrotomic/.github/blob/master/CONTRIBUTING.md) for details. You could also be interested in [CODE OF CONDUCT](https://github.com/Astrotomic/.github/blob/master/CODE_OF_CONDUCT.md).

### Security

[](#security)

If you discover any security related issues, please check [SECURITY](https://github.com/Astrotomic/.github/blob/master/SECURITY.md) for steps to report it.

Credits
-------

[](#credits)

- [Tom Witkowski](https://github.com/Gummibeer)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Treeware
--------

[](#treeware)

You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to [plant trees](https://www.bbc.co.uk/news/science-environment-48870920). If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at [offset.earth/treeware](https://plant.treeware.earth/Astrotomic/php-unavatar)

Read more about Treeware at [treeware.earth](https://treeware.earth)

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.6% 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 ~400 days

Total

4

Last Release

1121d ago

PHP version history (2 changes)0.1.0PHP ^7.4

0.1.1PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6187884?v=4)[Tom Herrmann](/maintainers/Gummibeer)[@Gummibeer](https://github.com/Gummibeer)

---

Top Contributors

[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (40 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

avatarclearbitdeviantartfacebookgithubgravatarhacktoberfestinstagramphp-unavatarsoundcloudtelegramtreewaretwitterunavataryoutubeavatarastrotomicunavatar

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/astrotomic-php-unavatar/health.svg)

```
[![Health](https://phpackages.com/badges/astrotomic-php-unavatar/health.svg)](https://phpackages.com/packages/astrotomic-php-unavatar)
```

###  Alternatives

[laravolt/avatar

Turn name, email, and any other string into initial-based avatar or gravatar.

2.0k5.8M39](/packages/laravolt-avatar)[astrotomic/laravel-unavatar

Laravel integration of unavatar service.

298.0k](/packages/astrotomic-laravel-unavatar)[yohang88/letter-avatar

Generate user avatar using name initials letter.

126584.2k3](/packages/yohang88-letter-avatar)[tomloprod/radiance

A deterministic mesh gradient avatar generator for PHP.

14010.2k](/packages/tomloprod-radiance)[astrotomic/laravel-dns

317.9k](/packages/astrotomic-laravel-dns)[splitbrain/php-ringicon

A indenticon/glyphicon like avatar generator

1614.6k1](/packages/splitbrain-php-ringicon)

PHPackages © 2026

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