Download the PHP package devwizardhq/laravel-filex without Composer
On this page you can find all versions of the php package devwizardhq/laravel-filex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devwizardhq/laravel-filex
More information about devwizardhq/laravel-filex
Files in devwizardhq/laravel-filex
Package laravel-filex
Short Description laravel-filex is a powerful and reusable Blade component that brings modern, asynchronous file uploads to Laravel applications. It supports features like drag-and-drop uploads, real-time progress indicators, preview rendering, chunked upload for large files, and temporary file handling with finalization on form submission.
License MIT
Homepage https://github.com/devwizardhq/laravel-filex
Informations about the package laravel-filex
Laravel Filex
Laravel Filex is a powerful, modern, and enterprise-grade file upload component for Laravel applications. Built on top of Dropzone.js, it provides a seamless drag-and-drop file upload experience with advanced features including chunked uploads, real-time progress tracking, comprehensive security validation, temporary file handling, quarantine system, and intelligent file management.
๐ Features
- ๐ฏ Easy Integration: Drop-in Blade component for instant file upload functionality
- ๐ Drag & Drop: Modern drag-and-drop interface with visual feedback and animations
- ๐ Progress Tracking: Real-time upload progress with visual indicators and completion states
- ๐ Chunked Uploads: Handle large files with automatic chunking for better performance and reliability
- โฑ๏ธ Temporary Storage: Safe temporary file handling with automatic expiration and cleanup
- ๐ Advanced Validation: Multi-layer client-side and server-side validation with custom rules
- ๐ก๏ธ Security Features: File signature validation, threat detection, quarantine system, and malicious content scanning
- ๐จ Highly Customizable: Extensive configuration options, theming, and styling flexibility
- โ๏ธ Cloud Ready: Support for local, S3, and other Laravel storage drivers with streaming
- ๐ Multi-language Support: Built-in localization for multiple languages (English, Bengali, with more coming)
- ๐งน Auto Cleanup: Scheduled cleanup of orphaned temporary files and quarantined content
- โก Performance Optimized: Lazy loading, intelligent caching, bulk operations, and memory management
- ๐ Retry Logic: Automatic retry mechanism for failed uploads with exponential backoff
- ๐ฑ Responsive Design: Mobile-friendly interface that works across all devices
- ๐๏ธ Rich API: Comprehensive API for programmatic file management and operations
- ๐ Performance Monitoring: Built-in performance metrics and optimization tools
- ๐จ Error Handling: Comprehensive error handling with detailed feedback and logging
๐ Requirements
- PHP 8.1+
- Laravel 11.x, or 12.x
- Minimum 256MB memory (recommended 512MB or higher for large files)
- File system write permissions for temporary storage
- Modern web browser with JavaScript support
๐ฆ Installation
Install the package via Composer:
Quick Setup (Recommended)
The package automatically publishes its configuration and assets when installed. For manual installation or to republish files:
Asset Integration
Add the assets directive to your main layout file:
This directive automatically includes all required CSS, JavaScript, and route configurations with performance optimizations.
๐ง Basic Usage
Simple File Upload
Multiple File Upload
Advanced Configuration
๐๏ธ Component Props
Property | Type | Default | Description |
---|---|---|---|
name |
string | 'files' | Input name for form submission |
multiple |
boolean | false | Allow multiple file selection |
accept |
string | null | Accepted file types (MIME types or extensions) |
maxFiles |
integer | null | Maximum number of files allowed |
maxSize |
integer | 10 | Maximum file size in MB |
minSize |
integer | null | Minimum file size in MB |
required |
boolean | false | Make the field required |
disabled |
boolean | false | Disable the uploader |
readonly |
boolean | false | Make the uploader read-only |
UI Customization Props
Property | Type | Default | Description |
---|---|---|---|
label |
string | null | Field label |
placeholder |
string | null | Placeholder text |
helpText |
string | null | Help text below the field |
showProgress |
boolean | true | Show upload progress |
showFileSize |
boolean | true | Show file sizes |
allowPreview |
boolean | true | Enable file previews |
showSuccessMessages |
boolean | false | Show success notifications |
showErrorNotifications |
boolean | true | Show error notifications |
errorTimeout |
integer | 5000 | Error message timeout (ms) |
successTimeout |
integer | 3000 | Success message timeout (ms) |
class |
string | '' | Additional CSS classes |
style |
string | '' | Inline styles |
wrapperClass |
string | '' | Wrapper element CSS classes |
Validation Props
Property | Type | Default | Description |
---|---|---|---|
rules |
array | [] | Laravel validation rules |
mimes |
string | null | Allowed MIME types |
extensions |
string | null | Allowed file extensions |
dimensions |
array/string | null | Image dimension constraints |
clientValidation |
boolean | true | Enable client-side validation |
Upload Behavior Props
Property | Type | Default | Description |
---|---|---|---|
autoProcess |
boolean | true | Auto-process uploaded files |
parallelUploads |
integer | 2 | Number of parallel uploads |
chunkSize |
integer | 1048576 | Chunk size for large files (bytes) |
retries |
integer | 3 | Number of retry attempts |
timeout |
integer | 30000 | Upload timeout (ms) |
thumbnailWidth |
integer | 120 | Thumbnail width for previews |
thumbnailHeight |
integer | 120 | Thumbnail height for previews |
thumbnailMethod |
string | 'contain' | Thumbnail resize method |
Event Props
Property | Type | Description |
---|---|---|
onSuccess |
string | JavaScript function called on successful upload |
onError |
string | JavaScript function called on upload error |
onComplete |
string | JavaScript function called when upload completes |
onFileAdded |
string | JavaScript function called when file is added |
onFileRemoved |
string | JavaScript function called when file is removed |
onUpload |
string | JavaScript function called during upload progress |
Debug and Testing Props
Property | Type | Default | Description |
---|---|---|---|
debug |
boolean | false | Enable debug mode for detailed logging |
value |
array/string | [] | Pre-populated file paths for editing |
๐๏ธ Processing Uploads in Controllers
Using the HasFilex Trait
The HasFilex
trait provides a clean, simple API for file upload operations:
Available HasFilex Methods
Simple Upload Methods
moveFile()
- Move a single file from request to permanent storagemoveFiles()
- Move multiple files from request to permanent storage
Validation Helpers
getFileValidationRules()
- Get validation rules for single file fieldsgetFilesValidationRules()
- Get validation rules for multiple file fields
Cleanup
cleanupTempFiles()
- Clean up temporary files if validation fails
Using the Service Directly
Using the Facade
File Visibility Control
Laravel Filex supports controlling file visibility when moving from temporary to permanent storage:
๐ Validation Rules
Laravel Filex provides custom validation rules for enhanced file validation:
Using Custom Validation Rules
Using the FileRule Facade
Available Validation Rules
Rule | Usage | Description |
---|---|---|
filex_mimes |
filex_mimes:jpeg,png,pdf |
Validate file MIME types |
filex_max |
filex_max:2048 |
Maximum file size in KB |
filex_min |
filex_min:100 |
Minimum file size in KB |
filex_image |
filex_image |
Validate as image file |
filex_file |
filex_file |
Basic file validation |
filex_dimensions |
filex_dimensions:min_width=100 |
Image dimension validation |
filex_size |
filex_size:1024 |
Exact file size in KB |
โ๏ธ Configuration
Laravel Filex provides extensive configuration options. Publish and customize the config file:
Configuration Table
Configuration Key | Type | Default | Description |
---|---|---|---|
Storage Settings | |||
storage.disks.default |
string | 'public' |
Default storage disk for permanent files |
storage.disks.temp |
string | 'local' |
Storage disk for temporary files |
storage.max_file_size |
integer | 10 |
Maximum file size in MB |
storage.temp_expiry_hours |
integer | 24 |
Hours before temp files expire |
File Validation | |||
validation.allowed_extensions |
array | [...] |
Array of allowed file extensions |
validation.allowed_mime_types |
array | [...] |
Array of allowed MIME types |
Upload Configuration | |||
upload.chunk.size |
integer | 1048576 |
Chunk size for large files (bytes) |
upload.chunk.max_retries |
integer | 3 |
Maximum retry attempts for chunks |
upload.chunk.timeout |
integer | 30000 |
Chunk upload timeout in milliseconds |
Route Configuration | |||
routes.prefix |
string | 'filex' |
Route prefix for upload endpoints |
routes.domain |
string | null |
Domain for upload routes |
routes.middleware |
array | [] |
Additional middleware for routes |
Performance Settings | |||
performance.memory_limit |
string | '1G' |
Memory limit for file operations |
performance.time_limit |
integer | 600 |
Time limit for file operations (seconds) |
performance.parallel_uploads |
integer | 2 |
Number of parallel uploads |
performance.chunk_threshold |
integer | 52428800 |
File size threshold for chunking (50MB) |
performance.batch_size |
integer | 5 |
Batch size for bulk operations |
performance.optimization.lazy_loading |
boolean | true |
Enable lazy loading of assets |
performance.optimization.enable_caching |
boolean | true |
Enable caching for better performance |
performance.optimization.cache_ttl |
integer | 3600 |
Cache TTL in seconds |
performance.optimization.enable_compression |
boolean | true |
Enable response compression |
performance.optimization.max_concurrent_uploads |
integer | 10 |
Maximum concurrent uploads |
Rate Limiting | |||
performance.rate_limiting.enabled |
boolean | true |
Enable rate limiting |
performance.rate_limiting.ip_limit |
integer | 50 |
Uploads per IP per time window |
performance.rate_limiting.user_limit |
integer | 100 |
Uploads per user per time window |
performance.rate_limiting.time_window |
integer | 3600 |
Time window in seconds |
performance.rate_limiting.suspend_time |
integer | 3600 |
Suspend duration in seconds |
Monitoring | |||
performance.monitoring.enable_metrics |
boolean | false |
Enable performance metrics |
performance.monitoring.log_performance |
boolean | false |
Log performance data |
performance.monitoring.max_log_entries |
integer | 1000 |
Maximum log entries to keep |
Security Settings | |||
security.suspicious_detection.enabled |
boolean | true |
Enable suspicious file detection |
security.suspicious_detection.quarantine_enabled |
boolean | true |
Enable quarantine for suspicious files |
security.suspicious_detection.scan_content |
boolean | true |
Enable content scanning |
security.suspicious_detection.validate_signatures |
boolean | true |
Enable file signature validation |
security.quarantine.directory |
string | 'quarantine' |
Quarantine directory name |
security.quarantine.retention_days |
integer | 30 |
Days to retain quarantined files |
security.quarantine.auto_cleanup |
boolean | true |
Auto cleanup quarantined files |
security.suspicious_extensions |
array | [...] |
File extensions to block/flag |
security.suspicious_content_patterns |
array | [...] |
Regex patterns for content scanning |
security.text_extensions_to_scan |
array | [...] |
Text file extensions to scan |
System Management | |||
system.cleanup.enabled |
boolean | true |
Enable automatic cleanup |
system.cleanup.schedule |
string | 'daily' |
Cleanup schedule (hourly/daily/weekly) |
Environment Variables
You can configure most settings using environment variables:
Route Configuration
You can customize the route prefix, domain, and middleware for file upload endpoints:
This allows you to:
- Change the route prefix from
/filex/
to any custom prefix - Set a specific domain for file upload routes
- Add custom middleware to protect upload routes
- Customize the route names
๐งน File Cleanup
Laravel Filex automatically manages temporary files with scheduled cleanup:
Manual Cleanup
Automatic Cleanup
The package automatically schedules cleanup based on your configuration:
The cleanup is automatically scheduled based on your configuration.
๐ Security Features
Laravel Filex includes comprehensive security features to protect against malicious file uploads:
Multi-layer Validation
- File Extension Validation: Check against allowed extensions
- MIME Type Validation: Verify declared MIME types
- File Signature Validation: Validate actual file headers/magic bytes
- Content Scanning: Scan file contents for suspicious patterns
Threat Detection
- Executable File Detection: Identify and block executable files
- Script Content Detection: Scan for embedded PHP, JavaScript, and other scripts
- Path Traversal Protection: Prevent directory traversal attacks
- Suspicious Filename Detection: Block files with suspicious names
Quarantine System
Suspicious files are automatically quarantined instead of being processed:
Custom Security Patterns
Add custom security patterns in your configuration:
Security Configuration
Enable or disable security features in your environment:
๐จ Styling and Customization
CSS Customization
Laravel Filex provides comprehensive CSS classes for customization:
Component Styling
Custom Event Handlers
Component Helpers
Each uploader instance exposes helper functions for programmatic control:
๐ฏ Advanced Features
Chunked Uploads
For large files, Laravel Filex automatically enables chunked uploads:
Progress Tracking & Events
Real-time upload progress with customizable callbacks:
Image Processing & Validation
Built-in image validation and processing:
File Editing & Updates
Handle existing files in edit forms:
Bulk Operations
Process multiple files efficiently:
๐ Performance Optimization
Configuration Optimization
Asset Optimization
The package includes built-in performance optimizations:
- Lazy Loading: Assets are loaded only when needed
- Asset Minification: Compressed CSS and JavaScript files
- CDN Support: Easy integration with CDN for static assets
- Caching: Smart caching of validation results and file metadata
Large File Handling
๐ง Commands
Laravel Filex provides several Artisan commands:
Command | Description |
---|---|
filex:install |
Install and publish package assets |
filex:cleanup-temp |
Clean up temporary and expired files |
filex:optimize |
Optimize package performance |
filex:info |
Display package information |
๐ Localization
Laravel Filex supports multiple languages out of the box.
Supported Languages
- ๐บ๐ธ English (en) - Default
- ๐ง๐ฉ Bengali (bn) - Complete
- ๐ช๐ธ Spanish (es) - Complete
- ๐ซ๐ท French (fr) - Complete
- ๐ฉ๐ช German (de) - Complete
- ๐ธ๐ฆ Arabic (ar) - Complete
- ๐จ๐ณ Chinese (zh) - Complete
- ๐ท๐บ Russian (ru) - Complete
- ๐ฎ๐ณ Hindi (hi) - Complete
- ๐ง๐ท Portuguese (pt) - Complete
- ๐ฏ๐ต Japanese (ja) - Complete
- ๐ฎ๐น Italian (it) - Complete
Publishing Language Files
Adding Custom Languages
- Create language directory:
resources/lang/vendor/filex/[locale]/
-
Copy English files:
- Translate the messages
- Set your application locale
Dynamic Language Switching
Contributing Translations
We welcome contributions for new languages! To contribute:
- Fork the repository
- Create a new language file based on the English version
- Translate all messages while keeping the same structure
- Test the translations in your application
- Submit a pull request
All versions of laravel-filex with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0