litepie / filehub
Modern Laravel file and media management package with security, performance, and flexibility
v1.0.2
2025-08-21 14:04 UTC
Requires
- php: ^8.2
- intervention/image: ^3.0
- laravel/framework: ^11.0|^12.0
- league/flysystem: ^3.0
- symfony/mime: ^6.0|^7.0
Requires (Dev)
- laravel/pint: ^1.0
- mockery/mockery: ^1.6
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
This package is auto-updated.
Last update: 2025-08-22 16:06:37 UTC
README
A modern, secure, and feature-rich file management package for Laravel 11+ applications.
Features
- ๐ Security First: Comprehensive file validation, malware scanning, and security checks
- ๐ Performance: Queue-based image processing and optimized storage
- ๐จ Image Processing: Automatic variant generation with Intervention Image v3
- โ๏ธ Multi-Storage: Support for local, S3, and any Laravel filesystem
- ๐ง Flexible: Trait-based integration with Eloquent models
- ๐ฆ Modern: Laravel 11+ and PHP 8.2+ with full type safety
- ๐งน Clean: Automatic orphaned file cleanup and management
- ๐ค User Tracking: Track who uploaded files, when, and from which IP address
Installation
composer require litepie/filehub
Quick Start
- Publish and run migrations:
php artisan vendor:publish --tag=filehub-migrations php artisan migrate
- Add trait to your model:
use Litepie\FileHub\Traits\HasFileAttachments; class Product extends Model { use HasFileAttachments; }
- Upload files:
$product = Product::create($data); $product->attachFile($request->file('image'), 'gallery');
- Display files:
$image = $product->getFirstFileAttachment('gallery'); echo $image->url(); // Full size echo $image->getVariantUrl('thumbnail'); // Thumbnail
User Tracking
Track who uploaded files with comprehensive user tracking:
// Check who uploaded a file $attachment = FileAttachment::find(1); if ($attachment->hasUploader()) { echo "Uploaded by: " . $attachment->uploader_name; echo "IP Address: " . $attachment->upload_ip_address; echo "Upload Date: " . $attachment->created_at; } // Get all files uploaded by a user use Litepie\FileHub\Facades\FileUploader; $files = FileUploader::getFilesByUploader(Auth::user()); $stats = FileUploader::getUploaderStats(Auth::user()); // Admin functions $allUploaders = FileUploader::getAllUploaders(); $recentUploads = FileUploader::getRecentUploads(50); $duplicates = FileUploader::findPotentialDuplicates();
Configuration
Publish the configuration file:
php artisan vendor:publish --tag=filehub-config
Frontend Components
FileHub now includes beautiful Vue.js and React components for file uploading with advanced features:
- ๐จ Modern UI: Beautiful, responsive design with smooth animations
- ๐ Drag & Drop: Native drag-and-drop support with visual feedback
- ๐ File Reordering: Drag files to reorder them before upload
- โ๏ธ Inline Editing: Edit file titles and captions directly
- ๐ Progress Tracking: Real-time upload progress indicators
- ๐ผ๏ธ Image Previews: Automatic thumbnail generation
Quick Start with Components
# Copy components to your project
cp -r vendor/litepie/filehub/resources/js/components/ resources/js/
<!-- Vue.js --> <FileHubUploader :upload-token="uploadToken" collection="gallery" :multiple="true" @upload-success="handleSuccess" />
// React <FileHubUploader uploadToken={uploadToken} collection="gallery" multiple={true} onUploadSuccess={handleSuccess} />
Documentation
For full documentation, visit our documentation site.
- Frontend Components Guide - Vue & React components
- Installation Guide - Step-by-step setup
- User Tracking Guide - Track file uploads
- Upload Security - Security features
License
MIT License. See LICENSE for details.