- How do I handle large file uploads (e.g., videos, datasets) in Laravel without timeouts or failures?
- Laravel Chunky splits files into smaller chunks, uploads them individually, and reassembles them on the server. This ensures reliability over unstable connections. Configure chunk size in `chunky.php` and use the frontend clients for Vue 3, React, or Livewire to trigger chunked uploads. The package automatically handles resumption if uploads fail midway.
- Does Laravel Chunky support batch uploads for multiple files at once?
- Yes, the package includes batch upload support. You can upload multiple files simultaneously using the frontend clients, and the backend processes them in parallel via queues. This is ideal for scenarios like bulk document submissions or user avatar updates. Batch progress tracking is also supported via events or broadcasting.
- What Laravel versions and PHP requirements does Laravel Chunky support?
- Laravel Chunky is compatible with Laravel 11, 12, and 13 and requires PHP 8.2 or higher. The package follows modern Laravel conventions, so integration with newer Laravel features (e.g., events, queues) is seamless. Always check the `UPGRADE.md` for version-specific migration notes if upgrading from `0.x`.
- How do I set up Laravel Chunky for production with queue workers and cleanup?
- For production, ensure you have a queue worker running (`php artisan queue:work`) to process `AssembleFileJob`. Configure `chunky.php` to enable auto-cleanup of temporary chunks (`auto_cleanup = true`) or schedule a cron job for manual cleanup. Use Redis or Memcached for cache locks to avoid deadlocks, and monitor queue jobs for failures.
- Can I customize the frontend upload UI (e.g., progress bars, validation) without forking the package?
- Yes, the frontend clients (Vue 3, React, Alpine.js, Livewire) are designed to be extensible. You can override default templates, styles, or validation logic by extending the core JS/TS package. For example, in Vue 3, you can wrap the `useChunkUpload` composable in a custom component to add your own progress bar or validation rules.
- How does Laravel Chunky handle authentication and authorization for uploads?
- The package integrates with Laravel’s auth system by default, ensuring uploaded files are tied to the authenticated user. You can customize authorization logic by implementing a `ChunkyAuthorizer` contract. For multi-tenant apps, extend the authorizer to include tenant checks or override the default ownership validation in `chunky.php`.
- What storage backends does Laravel Chunky support, and how do I configure them?
- Laravel Chunky uses Laravel’s filesystem (e.g., S3, local, FTP) for storing chunks and final files. Configure the default disk in `chunky.php` under `chunky.disk`. Chunks are stored in `storage/app/chunky/temp/` and final files in `storage/app/chunky/uploads/`. For cloud storage like S3, ensure your disk configuration supports multipart uploads for large files.
- Are there alternatives to Laravel Chunky for chunked uploads in Laravel?
- Yes, alternatives include `spatie/laravel-medialibrary` (for media management with chunking support), `intervention/image` (for image processing), or custom solutions using libraries like `uploadcare` or `tus-php-client`. However, Laravel Chunky stands out with its event-driven architecture, framework-agnostic frontend clients, and built-in resumability for large files.
- How do I monitor upload progress or failures in real-time for users?
- Laravel Chunky supports broadcasting upload progress and events via Laravel Echo (e.g., Pusher, Socket.io). Listen to `ChunkUploaded` or `UploadCompleted` events and emit them to a broadcast channel. Frontend clients can then display real-time progress or notifications. For observability, log events or use monitoring tools to track upload durations and failures.
- What happens if a chunked upload fails midway? Can users resume it?
- Yes, Laravel Chunky automatically tracks uploaded chunks in the database. If an upload fails, users can resume it from where they left off by reinitializing the upload process. The frontend clients handle this seamlessly, and the backend reassembles only the missing chunks. Ensure your cache driver (Redis recommended) is configured for proper lock management during resumption.