Download the PHP package mohamedgaldi/vilt-filepond without Composer
On this page you can find all versions of the php package mohamedgaldi/vilt-filepond. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mohamedgaldi/vilt-filepond
More information about mohamedgaldi/vilt-filepond
Files in mohamedgaldi/vilt-filepond
Package vilt-filepond
Short Description A Laravel package for handling file uploads with FilePond in VILT stack
License MIT
Homepage https://github.com/mohamedgaldi/vilt-filepond
Informations about the package vilt-filepond
Laravel FilePond Package for VILT Stack
A comprehensive Laravel package for handling file uploads using FilePond in VILT (Vue, Inertia, Laravel, Tailwind) stack applications.
Features
- 🚀 Easy Integration - Seamless FilePond integration with Laravel
- 📊 Polymorphic Relations - Works with any Eloquent model
- 💾 Chunked Uploads - Support for large file uploads via chunking
- 🔄 Smart Management - Temporary file handling with automatic cleanup
- 📁 Flexible Uploads - Support for single and multiple file uploads
- 🏷️ Collections - Organize files using collections (images, documents, etc.)
- 🌐 Multi-language - Supports multiple locales (Arabic, French, Spanish, English)
- 🌗 Light/Dark Mode - Customizable theme with light and dark mode support
- 🔒 Security First - Built-in validation and security features
Requirements
- Laravel 11.0 or higher
- VILT stack (Vue.js, Inertia.js, Laravel, Tailwind CSS)
- PHP 8.1 or higher
Installation
1. Install the Package
2. Install Frontend Dependencies
3. Publish Package Assets
4. Import FilePond Styles
Add the following imports to your app.css file before your Tailwind directives:
⚠️ Important: The FilePond CSS imports must come before Tailwind directives to ensure proper styling.
5. Run Migrations
6. Configure Storage
Ensure your public disk is properly configured in config/filesystems.php and create the storage link:
7. Environment Configuration
APP_URL Configuration
Ensure your APP_URL in .env matches your development server URL:
8. Configure Inertia Middleware
Add the CSRF token and config values to your HandleInertiaRequests middleware:
Quick Start
1. Prepare Your Model
Add the HasFiles trait to any model that needs file uploads:
2. Create a New Record with Files
3. Update Existing Records
4. Handle Files in Controller
Component Props
FileUpload Component
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue |
Array | [] |
Array of temporary folder names |
initialFiles |
Array | [] |
Array of existing files to display |
allowedFileTypes |
Array | Image types | Accepted MIME types |
allowMultiple |
Boolean | false |
Allow multiple file uploads |
maxFiles |
Number | 1 |
Maximum number of files |
maxFileSize |
String | "10MB" |
Maximum file size |
collection |
String | "default" |
File collection name |
disabled |
Boolean | false |
Disable the component |
required |
Boolean | false |
Mark as required field |
theme |
String | "light" |
Theme for the component (light or dark) |
width |
String | "auto" |
Custom width for the component (e.g., "40rem") |
Events
| Event | Payload | Description |
|---|---|---|
@file-added |
{ folder, file } |
Fired when a file is uploaded |
@file-removed |
{ fileId, type, file } |
Fired when a file is removed |
@error |
error |
Fired when an error occurs |
Configuration
Customize the package behavior in config/vilt-filepond.php:
API Reference
HasFiles Trait Methods
| Method | Description |
|---|---|
files() |
Get all files relationship |
getFilesByCollection(string $collection) |
Get files by collection |
getFirstFile(string $collection = 'default') |
Get first file from collection |
hasFiles(string $collection = null) |
Check if model has files |
deleteFiles(string $collection = null) |
Delete files by collection |
FilePondService Methods
| Method | Description |
|---|---|
storeTempFile(UploadedFile $file, string $collection) |
Store temporary file |
moveTempFileToModel($model, string $folder, string $collection, int $order) |
Move temp file to model |
handleFileUploads($model, array $tempFolders, string $collection) |
Handle multiple uploads |
handleFileUpdates($model, array $tempFolders, array $removedFiles, string $collection) |
Handle file updates |
cleanupTempFiles() |
Clean up old temporary files |
Troubleshooting
Common Issues
- Images not loading: Check your
APP_URLin.envmatches your server URL - Styles not working: Ensure FilePond CSS is imported before Tailwind
- Upload failures: Verify CSRF token is shared via Inertia middleware
- Permission errors: Run
php artisan storage:linkand check file permissions
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This package is open-sourced software licensed under the MIT license.
Made with ❤️ for the VILT Stack community