deepcube / handoff-image-upload
A powerful Filament component for image uploads with camera capture, QR code sharing, and temporary file management for Laravel applications
Fund package maintenance!
deepcube-srl
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^8.1
- filament/filament: ^3.3
- filament/forms: ^3.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
Suggests
- intervention/image: Required for image manipulation and processing
- spatie/laravel-medialibrary: Advanced media management capabilities
This package is auto-updated.
Last update: 2025-09-23 14:01:42 UTC
README
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
-
Create a new folder for the language in
lang/vendor/handoff-image-upload/
:mkdir -p lang/vendor/handoff-image-upload/es
-
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
-
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.