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

ActiveLibrary

m2code/avatar
=============

Flexible and deterministic avatar generator

v1.0.2(1mo ago)01↓100%MITPHPPHP ^8.2

Since Apr 6Pushed 1mo agoCompare

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

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

M2Code Avatar
=============

[](#m2code-avatar)

Flexible and deterministic avatar generator library, ready for Laravel integration.

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

[](#installation)

```
composer require m2code/avatar
```

Laravel Usage (Facade)
----------------------

[](#laravel-usage-facade)

```
use M2Code\Avatar\Facades\Avatar;

$result = Avatar::make('Marij Mokoginta')->generate();

echo $result->type;    // svg
echo $result->mime;    // image/svg+xml
echo $result->content; // SVG content
echo $result->toBase64();
```

Or use Laravel alias directly:

```
$result = \Avatar::make('Marij Mokoginta')->generate();
```

Standalone Usage (No Laravel)
-----------------------------

[](#standalone-usage-no-laravel)

```
use M2Code\Avatar\Application\Avatar\Avatar;

$result = Avatar::make('Marij Mokoginta')
    ->size(128)
    ->initials(2)
    ->background('#ff0000')
    ->generate();
```

Laravel Configuration
---------------------

[](#laravel-configuration)

Publish config:

```
php artisan vendor:publish --tag=avatar-config
```

Configuration
-------------

[](#configuration)

Default config is in `config/avatar.php`:

```
return [
    'default_driver' => 'initial',
    'initial' => [
        'length' => 2,
        'size' => 100,
        'font_size' => 40,
        'background' => 'auto',
    ],
];
```

`background => auto` means deterministic color based on the seed hash.

Testing
-------

[](#testing)

```
composer test
```

Architecture
------------

[](#architecture)

- `Application`: Fluent entrypoint for avatar generation.
- `AvatarServiceProvider`: Laravel integration layer.
- `Domain`: Contracts and value objects.
- `Drivers`: Concrete avatar generators.
- `Core/Resolvers`: Driver resolver.
- `Support`: Internal config reader.
- `Facades`: Laravel facade entrypoint (`Avatar`).

Notes
-----

[](#notes)

- Deterministic output based on seed.
- No storage integration included.
- Designed as foundation for future drivers.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance93

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Every ~0 days

Total

3

Last Release

34d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPest

### Embed Badge

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

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)

PHPackages © 2026

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