PHPackages                             laravel-enso/avatarmanager - 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. laravel-enso/avatarmanager

Abandoned → [laravel-enso/avatars](/?search=laravel-enso%2Favatars)Library[Utility &amp; Helpers](/categories/utility)

laravel-enso/avatarmanager
==========================

User Avatar manager dependency for Laravel Enso

4.5.7(2mo ago)616.4k61MITPHP

Since Jun 18Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/laravel-enso/avatars)[ Packagist](https://packagist.org/packages/laravel-enso/avatarmanager)[ Docs](https://github.com/laravel-enso/avatars)[ RSS](/packages/laravel-enso-avatarmanager/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (13)Versions (157)Used By (1)

Avatars
=======

[](#avatars)

[![License](https://camo.githubusercontent.com/9c5ba7a8c44f2c2d1b982f4b23fdcf7f0b7ddb5aa9655a810a94aed294eab76e/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f617661746172732f6c6963656e7365)](LICENSE)[![Stable](https://camo.githubusercontent.com/7f6cdce6636c6f8295b77bbf499556bf75f643a498289bba3d8565cfa44a7478/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f617661746172732f76657273696f6e)](https://packagist.org/packages/laravel-enso/avatars)[![Downloads](https://camo.githubusercontent.com/d246614960dea6fc4d6369b9b8c7df6f9871bdbe2f7bb53f3e77353b0b7e694a/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f617661746172732f646f776e6c6f616473)](https://packagist.org/packages/laravel-enso/avatars)[![PHP](https://camo.githubusercontent.com/da7cf113b588d26fe679dfefe4a15009272ed358ad4e786ad3c78b45faa61d69/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322532422d3737376262342e737667)](composer.json)[![Issues](https://camo.githubusercontent.com/b336feb175872e3b9113c7a928bc9e3b121dafb4e7eaf763d18390326280f1f3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c61726176656c2d656e736f2f617661746172732e737667)](https://github.com/laravel-enso/avatars/issues)[![Merge Requests](https://camo.githubusercontent.com/c6aad833adb9eb6979e2265e551faccde798ffb5a019dc017165e619da850ee2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6c61726176656c2d656e736f2f617661746172732e737667)](https://github.com/laravel-enso/avatars/pulls)

Description
-----------

[](#description)

Avatars is Laravel Enso's user avatar package.

It attaches one avatar record to each user, exposes authenticated endpoints for viewing, uploading, and regenerating avatars, and integrates with Enso's file pipeline so custom uploads are stored and transformed consistently.

The package also generates default avatars automatically. It prefers Gravatar when a public image exists for the user's email address and falls back to a locally generated Laravolt avatar when it does not.

The frontend integration lives primarily in the Enso user profile experience and reusable avatar components from `@enso-ui/users`.

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

[](#installation)

This package comes pre-installed in Laravel Enso applications that support user profile avatars.

For standalone installation in an Enso-based application:

```
composer require laravel-enso/avatars
```

The package auto-registers its service providers, loads migrations, registers API routes, observes user creation, and exposes the avatar generation command.

Run the migrations after installation:

```
php artisan migrate
```

If you need the package storage scaffolding, publish it with:

```
php artisan vendor:publish --tag=avatars-storage
```

Features
--------

[](#features)

- Adds a one-to-one avatar relation to `LaravelEnso\Users\Models\User` through dynamic methods.
- Adds a `generateAvatar()` dynamic method to users for regenerating their default avatar.
- Generates a default avatar automatically whenever a new user is created.
- Prefers Gravatar and falls back to a generated Laravolt image when no Gravatar exists.
- Stores uploaded avatar files through `laravel-enso/files`.
- Deletes the previously attached file when an avatar is replaced.
- Enforces square image uploads.
- Exposes avatar display, upload, and regenerate endpoints under the core API namespace.
- Registers permissions and authorization for avatar operations.

Usage
-----

[](#usage)

The package binds an `avatar()` relation and `generateAvatar()` method to the Enso user model:

```
$user->avatar;
$user->generateAvatar();
```

Store a custom uploaded avatar for the authenticated user:

```
use Illuminate\Http\UploadedFile;

$request->validate([
    'avatar' => 'required|image:allow_svg|dimensions:ratio=1',
]);

$request->user()->avatar->store(
    UploadedFile::fake()->image('avatar.png', 512, 512),
);
```

Regenerate the default avatar:

```
$request->user()->generateAvatar();
```

Display an avatar in the browser by hitting the show endpoint:

```
route('core.avatars.show', $user->avatar->id);
```

::: warning Note The package is designed to work with a single avatar per user. When you regenerate or upload a new avatar, the previously attached file is removed automatically. :::

API
---

[](#api)

### Routes

[](#routes)

All package routes are registered under:

- prefix: `api/core/avatars`
- name prefix: `core.avatars.`
- middleware: `api`, `auth`, `core`

Endpoints:

- `POST /api/core/avatars`
- `PATCH /api/core/avatars/{avatar}`
- `GET /api/core/avatars/{avatar}`

### Authorization

[](#authorization)

`LaravelEnso\Avatars\Policies\AvatarPolicy`

- superiors may manage any avatar
- regular users may update only their own avatar
- impersonating users may not update avatars

### Model

[](#model)

`LaravelEnso\Avatars\Models\Avatar`

Persisted fields:

- `user_id`
- `file_id`
- `url`

Relationships:

- `user()`
- `file()`

Useful methods:

- `store(UploadedFile $uploadedFile)`
- `extensions()`
- `mimeTypes()`
- `imageWidth()`
- `imageHeight()`

### Dynamic User Integration

[](#dynamic-user-integration)

Dynamic additions on `LaravelEnso\Users\Models\User`:

- `avatar()`
- `generateAvatar()`

### Command

[](#command)

Generate missing avatars for users without one:

```
php artisan enso:avatars:generate
```

Depends On
----------

[](#depends-on)

Required Enso packages:

- [`laravel-enso/core`](https://docs.laravel-enso.com/backend/core.html) [↗](https://github.com/laravel-enso/core)
- [`laravel-enso/dynamic-methods`](https://docs.laravel-enso.com/backend/dynamic-methods.html) [↗](https://github.com/laravel-enso/dynamic-methods)
- [`laravel-enso/files`](https://docs.laravel-enso.com/backend/files.html) [↗](https://github.com/laravel-enso/files)
- [`laravel-enso/image-transformer`](https://docs.laravel-enso.com/backend/image-transformer.html) [↗](https://github.com/laravel-enso/image-transformer)
- [`laravel-enso/migrator`](https://docs.laravel-enso.com/backend/migrator.html) [↗](https://github.com/laravel-enso/migrator)
- [`laravel-enso/users`](https://docs.laravel-enso.com/backend/users.html) [↗](https://github.com/laravel-enso/users)

Companion frontend package:

- [`@enso-ui/users`](https://docs.laravel-enso.com/frontend/users.html) [↗](https://github.com/enso-ui/users)

External dependency:

- [`laravolt/avatar`](https://github.com/laravolt/avatar) [↗](https://github.com/laravolt/avatar)

Contributions
-------------

[](#contributions)

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance86

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 61.5% 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 ~22 days

Recently: every ~2 days

Total

147

Last Release

75d ago

Major Versions

1.3.1 → 2.0.02017-09-26

1.3.2 → 2.1.122018-02-13

1.3.4 → 2.1.132018-03-05

2.5.11 → 3.0.02020-06-26

3.2.8 → 4.0.02022-02-25

PHP version history (2 changes)1.1.0PHP &gt;=5.6.4

1.1.10PHP &gt;=7.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16073274?v=4)[Adrian Ocneanu](/maintainers/aocneanu)[@aocneanu](https://github.com/aocneanu)

---

Top Contributors

[![aocneanu](https://avatars.githubusercontent.com/u/16073274?v=4)](https://github.com/aocneanu "aocneanu (174 commits)")[![gandesc](https://avatars.githubusercontent.com/u/14071925?v=4)](https://github.com/gandesc "gandesc (58 commits)")[![raftx24](https://avatars.githubusercontent.com/u/10864136?v=4)](https://github.com/raftx24 "raftx24 (21 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (10 commits)")[![vmcvlad](https://avatars.githubusercontent.com/u/37445394?v=4)](https://github.com/vmcvlad "vmcvlad (9 commits)")[![GITmanuela](https://avatars.githubusercontent.com/u/44998004?v=4)](https://github.com/GITmanuela "GITmanuela (5 commits)")[![AbdullahiAbdulkabir](https://avatars.githubusercontent.com/u/33360580?v=4)](https://github.com/AbdullahiAbdulkabir "AbdullahiAbdulkabir (3 commits)")[![jlsjonas](https://avatars.githubusercontent.com/u/932193?v=4)](https://github.com/jlsjonas "jlsjonas (1 commits)")[![DevIonut](https://avatars.githubusercontent.com/u/19207797?v=4)](https://github.com/DevIonut "DevIonut (1 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")

---

Tags

avataravatarslaravellaravel-ensolaravelavataravatarslaravel-enso

### Embed Badge

![Health badge](/badges/laravel-enso-avatarmanager/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-enso-avatarmanager/health.svg)](https://phpackages.com/packages/laravel-enso-avatarmanager)
```

###  Alternatives

[laravel-enso/data-import

Excel Importer dependency for Laravel Enso

2044.0k6](/packages/laravel-enso-data-import)[laravel-enso/localisation

Language and translation management for Laravel Enso

1362.8k11](/packages/laravel-enso-localisation)[laravel-enso/tutorials

Tutorial management backend for Laravel Enso

1140.7k](/packages/laravel-enso-tutorials)[laravel-enso/core

The backend shell of a Laravel Enso application

3465.3k206](/packages/laravel-enso-core)[laravel-enso/permissions

Permission management for Laravel Enso

1244.2k52](/packages/laravel-enso-permissions)[laravel-enso/comments

Comments Manager for Laravel Enso

1140.8k1](/packages/laravel-enso-comments)

PHPackages © 2026

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