mapo-89/laravel-avatar-manager

Simple Laravel package to serve avatars by email hash

v1.1.0 2025-06-15 01:51 UTC

This package is auto-updated.

Last update: 2025-06-15 02:29:10 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

Laravel Avatar Manager is a lightweight, self-hosted Laravel package for managing user avatars - with support for Gravatar-compatible hashes, local storage and easy integration into existing projects.

📖 This README is also available in 🇩🇪 German.

✨ Features

  • Avatar URLs based on MD5(Email), as with Gravatar
  • Fallback to default avatars
  • Seamless integration with the Laravel user model
  • SQLite compatible ✅

🛠️ Installation

You can install the package via composer:

composer require mapo-89/laravel-avatar-manager

⚙️ Configuration

php artisan vendor:publish --provider="Mapo89\LaravelAvatarManager\AvatarManagerServiceProvider"
php artisan storage:link

You can also publish specifically:

# Configuration only
php artisan vendor:publish --tag=avatar-manager-config

# Only assets (e.g. standard images, CSS)
php artisan vendor:publish --tag=avatar-manager-assets

Testing

To keep the package flexible and testable, the AvatarManager uses an interface for accessing user data: Mapo89\LaravelAvatarManager\Contracts\UserProviderInterface

For tests, the test user class is bound via TestUserProvider.

Production operation

In the service provider, the package binds the real user class (e.g. App\Models\User) by default:

public function register()
{
 $this->app->bind(
 \Mapo89\LaravelAvatarManager\Contracts\UserProviderInterface::class,
 \Mapo89\LaravelAvatarManager\Services\UserProvider::class
 );
}

The UserProvider class implements the logic to find users via email hash.

Execute tests

The tests can be executed with various commands:

composer test

./vendor/bin/phpunit --testdox --stderr

./vendor/bin/pest

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email info@postler.de instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.