定制 deepcube/handoff-image-upload 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

deepcube/handoff-image-upload

Composer 安装命令:

composer require deepcube/handoff-image-upload

包简介

A powerful Filament component for image uploads with camera capture, QR code sharing, and temporary file management for Laravel applications

README 文档

README

Static Badge Static Badge

A Filament component for image uploads with support for camera, QR Code, and direct upload. Allows users to upload images directly from the current device or using a QR Code to upload from a mobile device.

Features

  • Filament Integration: Native component for Filament Forms
  • Multiple Upload Methods: Direct upload, camera capture, or via QR Code
  • Temporary Management: Automatic handling of temporary images
  • Multilingual: Support for customizable translations
  • Cleanup Command: Automatic command to clean temporary images

Installation

Install the package via Composer:

composer require deepcube/handoff-image-upload

Run the migrations:

php artisan migrate

Publish the configuration files (optional):

php artisan vendor:publish --tag="handoff-image-upload-config"

Publish the views (optional):

php artisan vendor:publish --tag="handoff-image-upload-views"

Filament Forms Integration

To use the component in a Filament form, add the field to your Form Schema:

use Deepcube\HandoffImageUpload\HandoffImageUpload;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            HandoffImageUpload::make('profile_image')
                ->label('Profile Image'),
                
            HandoffImageUpload::make('document_scan')
                ->label('Document Scan'),
                
            // Other fields...
        ]);
}

Complete Resource Example:

<?php

namespace App\Filament\Resources;

use App\Models\User;
use Deepcube\HandoffImageUpload\HandoffImageUpload;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;

class UserResource extends Resource
{
    protected static ?string $model = User::class;
    
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\Components\TextInput::make('name')
                    ->label('Name')
                    ->required(),
                    
                Forms\Components\TextInput::make('email')
                    ->label('Email')
                    ->email()
                    ->required(),
                    
                HandoffImageUpload::make('avatar')
                    ->label('User Avatar'),
                    
                HandoffImageUpload::make('document')
                    ->label('Identity Document'),
            ]);
    }
    
    // ... rest of the Resource
}

Temporary Images Cleanup Command

The package includes a command to automatically clean temporary images:

Basic Usage

php artisan handoff-image:cleanup-temp

Available Options

# Delete files older than 48 hours
php artisan handoff-image:cleanup-temp --hours=48

# Dry-run mode (shows what would be deleted without actually deleting)
php artisan handoff-image:cleanup-temp --dry-run

# Combination of options
php artisan handoff-image:cleanup-temp --hours=12 --dry-run

Automation with Task Scheduler

Add the command to your app/Console/Kernel.php to run it automatically:

protected function schedule(Schedule $schedule)
{
    // Daily cleanup of temporary images older than 24 hours
    $schedule->command('handoff-image:cleanup-temp')
             ->daily()
             ->at('02:00');
             
    // Or every 6 hours
    $schedule->command('handoff-image:cleanup-temp --hours=6')
             ->everySixHours();
}

Translations

Publishing Translation Files

To customize translations, publish the language files:

php artisan vendor:publish --tag="handoff-image-upload-translations"

Translation files will be published to lang/vendor/handoff-image-upload/.

Translation Structure

The package includes translations for:

  • English (en/handoff-image-upload.php)
  • Italian (it/handoff-image-upload.php)

Adding New Languages

  1. Create a new folder for the language in lang/vendor/handoff-image-upload/:

    mkdir -p lang/vendor/handoff-image-upload/es
  2. Copy the English file as a base:

    cp lang/vendor/handoff-image-upload/en/handoff-image-upload.php \
       lang/vendor/handoff-image-upload/es/handoff-image-upload.php
  3. Translate the strings in the new file:

    <?php
    // lang/vendor/handoff-image-upload/es/handoff-image-upload.php
    return [
        'take_photo_instruction' => 'Toma una foto para subirla',
        'switch_camera' => 'Cambiar cámara',
        'take_photo' => 'Tomar foto',
        'retry' => 'Reintentar',
        'confirm' => 'Confirmar',
        // ... other translations
    ];

Customizing Existing Translations

After publishing the translations, you can modify the files in lang/vendor/handoff-image-upload/ to customize the messages according to your needs.

Usage

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

deepcube/handoff-image-upload 适用场景与选型建议

deepcube/handoff-image-upload 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 deepcube/handoff-image-upload 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-22