承接 mapo-89/laravel-avatar-manager 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mapo-89/laravel-avatar-manager

Composer 安装命令:

composer require mapo-89/laravel-avatar-manager

包简介

Simple Laravel package to serve avatars by email hash

README 文档

README

Latest Version on Packagist Total Downloads GitHub Actions License

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
  • Local storage of uploaded avatars
  • API-based avatar upload using email + API key (no login required)
  • SQLite compatible ✅

🚀 API Avatar Upload Endpoint

The package provides an optional upload endpoint without requiring user registration.

POST /api/avatars/upload

Headers:

  • X-API-KEY: A valid API key defined in config/avatar-manager.php

Body Parameters:

  • email (string, required) – The email address used to compute the avatar hash
  • avatar (image, required) – The uploaded avatar image (max 2MB)

Response:

  • 200 OK: Avatar successfully uploaded
  • 401 Unauthorized: Missing or invalid API key
  • 422 Unprocessable Entity: Validation failed (e.g. invalid email or image)
  • 409 Conflict: Upload aborted – user already has an existing profile photo

ℹ️ If a user exists in your system and already has a profile_photo_path set, the API will reject a new avatar upload via the endpoint to avoid unintended overrides.

The uploaded image will be saved to:

storage/app/public/avatars/{md5(email)}.jpg

Configuration

Add one or more API keys to your config:

// config/avatar-manager.php
'api_keys' => [
    env('AVATAR_API_KEY'),
],

And in your .env file:

AVATAR_API_KEY=your-api-key

🛠️ 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.

mapo-89/laravel-avatar-manager 适用场景与选型建议

mapo-89/laravel-avatar-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「gravatar」 「php」 「laravel」 「avatar」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mapo-89/laravel-avatar-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mapo-89/laravel-avatar-manager 我们能提供哪些服务?
定制开发 / 二次开发

基于 mapo-89/laravel-avatar-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-14