Download the PHP package hayderhatem/filament-excel-import without Composer
On this page you can find all versions of the php package hayderhatem/filament-excel-import. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hayderhatem/filament-excel-import
More information about hayderhatem/filament-excel-import
Files in hayderhatem/filament-excel-import
Package filament-excel-import
Short Description Filament Excel import trait for Laravel
License MIT
Informations about the package filament-excel-import
Filament Excel Import
A powerful Excel import package for Filament that provides seamless Excel file import functionality with automatic column mapping and memory-efficient processing.
Installation
You can install the package via composer:
Features
- 📊 Excel & CSV Import: Support for
.xlsx
,.xls
,.csv
and other spreadsheet formats - 🔄 Drop-in Replacement: Compatible with Filament's existing
CanImportRecords
trait - 🗂️ Multi-Sheet Support: Import from specific sheets in Excel workbooks
- 🎯 Smart Column Mapping: Automatic header detection and column mapping
- 🚀 Memory Efficient: Handles large files without memory exhaustion
- 🔁 Streaming Import: Automatic streaming for large files (configurable)
- 📝 Custom Import Options: Add additional form fields to import modal
- 🌐 Multi-language: Translatable error messages and UI text
- ⚠️ Error Handling: User-friendly error messages and failed rows export
- 🎨 Easy Configuration: Minimal setup required
Usage
Basic Setup
Replace Filament's CanImportRecords
trait with CanImportExcelRecords
in your resource:
Configuration Options
The package supports all of Filament's original import options plus additional Excel-specific features:
Multi-Sheet Excel Files
When importing Excel files with multiple sheets, users can select which sheet to import:
The import modal will automatically show a sheet selector dropdown if multiple sheets are detected.
Additional Form Components
You can add custom form fields to the import modal:
Access additional form data in your importer:
Memory Optimization & Streaming
Automatic Streaming
The package automatically detects large files and switches to streaming mode to prevent memory exhaustion:
Manual Streaming Control
Force streaming mode on or off:
Memory Usage Comparison
File Size | Standard Import | Streaming Import |
---|---|---|
1MB | ~10MB RAM | ~5MB RAM |
100MB | Memory Error | ~5MB RAM |
1GB | Memory Error | ~5MB RAM |
Advanced Configuration
Custom Job
You can use your own import job class:
Error Handling
The package provides user-friendly error messages for common database errors:
Custom Error Messages
Add custom error message translations:
File Support
Supported Formats
- Excel:
.xlsx
,.xls
,.xlsm
,.xltx
,.xltm
- CSV:
.csv
,.txt
- All formats supported by PhpSpreadsheet
File Upload Behavior
- Small files: Full preview with dropdown column mapping
- Large files: Header-only reading for memory efficiency
- Very large files: Manual text input mapping
- Any size: Import processing always works via streaming
API Compatibility
The package is a drop-in replacement for Filament's CanImportRecords
trait:
Filament Method | Supported | Notes |
---|---|---|
importer() |
✅ | Fully compatible |
job() |
✅ | Fully compatible |
chunkSize() |
✅ | Fully compatible |
maxRows() |
✅ | Fully compatible |
headerOffset() |
✅ | Fully compatible |
options() |
✅ | Fully compatible |
fileValidationRules() |
✅ | Enhanced for Excel |
Additional Methods
Method | Description |
---|---|
useStreaming(bool\|null) |
Control streaming mode |
streamingThreshold(int) |
Set auto-streaming threshold |
activeSheet(int) |
Set Excel sheet to import |
additionalFormComponents(array) |
Add custom form fields |
Migration from CanImportRecords
Migrating from Filament's built-in import is simple:
Step 1: Update the Trait
Step 2: No Other Changes Required
All your existing code will work exactly the same! The package is designed as a drop-in replacement.
Step 3: Optional Enhancements
Take advantage of new features:
Testing
The package includes comprehensive tests:
Requirements
- PHP 8.1+
- Laravel 10+
- Filament 3+
- PhpSpreadsheet (automatically installed)
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email the maintainer instead of using the issue tracker.
Credits
- Hayder Hatem
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-excel-import with dependencies
laravel/framework Version ^10.0|^11.0
filament/filament Version ^3.2
phpoffice/phpspreadsheet Version ^1.29.9|^2.0