jobtech/laravel-chunky
jobtech/laravel-chunky adds chunked, resumable file uploads to Laravel apps, splitting large files into smaller requests and assembling them server-side. It offers a simple API for integrating reliable big-file uploads into forms and storage workflows.
composer require jobtech/laravel-chunky. The package publishes a service provider that auto-registers inside Laravel 10/11.php artisan vendor:publish --tag=chunky-config — you'll want to review the default disk, temp/chunk storage path, and any TTL/cleanup settings before wiring it into endpoints.config/chunky.php / filesystems.php. Chunks are written to the same disk as the final file, so pick something with enough space and writable permissions.src/, config/, and any routes/ file to see the exact facade name, method signatures, and driver contract before you code against them.file.slice() and posts each slice to a POST /uploads/{id}/chunks style endpoint — typically videos, CSVs, or archives that exceed upload_max_filesize / post_max_size.A minimal happy path: create an upload (returns an upload ID), loop client-side slices into chunk endpoints, then call a complete/merge action that concatenates chunks into the final file and returns its path.
chunky follows Laravel's Manager pattern. Use the default disk driver for most cases; register a custom driver via the manager's extend() only if you need non-standard storage behavior (e.g., an S3 multipart implementation).init, chunk, complete — and put business logic in a service. This makes it trivial to swap the package later if it goes stale.init, chunk, and complete behind the same policy. A leaked upload ID should not allow appending or finalizing someone else's file — check ownership on every chunk call, not just complete.complete runs, dispatch a job (ProcessUpload) for virus scanning, image resizing, thumbnail generation, or moving the merged file to permanent storage. Don't do heavy work inside the request that finalizes the upload.GET /uploads/{id} status endpoint that returns received chunk indices. Clients can then skip already-uploaded chunks on page reload.complete call. Abandoned uploads are the #1 way this package silently fills your disk.Storage::fake() and drive the full flow through HTTP tests. Assert the final file's bytes equal the concatenated chunks — hash comparison, not just assertExists.upload_max_filesize and post_max_size. If you set the JS slice to 10 MB but PHP caps at 2 MB, every chunk 413s. Make chunk size a config value shared with the frontend.Str::isUuid, integer indices) before using them in storage paths. Never interpolate the original filename into a path without basename() and a whitelist.max_execution_time or the load balancer's idle timeout. Either bump limits on that route or push merge into a queued job and return early with a pending status./tmp. A single abandoned 50 GB upload takes down the box, not just that user..env changes FILESYSTEM_DISK between requests, complete will "succeed" but the file won't be where the client expects. Pin the disk explicitly per upload.composer.json, read src/ before you upgrade, and wrap the facade in your own UploadService so a future replacement (e.g., pion/laravel-chunk-upload) is a one-file change.extend() for custom drivers, the config file for disk/TTL settings, and possibly events for chunk.uploaded / upload.completed. Prefer event listeners over editing the package source for logging and metrics.Log::info around the manager calls in your controller.How can I help you explore Laravel packages today?