ghostcompiler / laravel-uploads
Laravel Uploads for simple, secure file storage
Requires
- php: ^8.1
- illuminate/support: ^10.0 || ^11.0 || ^12.0 || ^13.0
Requires (Dev)
- orchestra/testbench: ^8.0 || ^9.0 || ^10.0 || ^11.0@dev
- phpunit/phpunit: ^10.0 || ^11.0 || ^12.0
Suggests
- ext-gd: Used for image compression plus AVIF/WEBP conversion when supported by the PHP build.
- ext-imagick: Used as an automatic fallback for AVIF/WEBP conversion when GD support is unavailable or limited.
- laravel/framework: Required in the host application to provide Eloquent, routing, console, HTTP, and filesystem integration.
README
Laravel Uploads manages local/cloud file storage, tracks upload metadata, generates secure tokenized preview URLs, integrates with Eloquent models, and supports real-time image optimization. It also features on-demand proxy streaming for remote URLs with zero local disk footprint.
Installation
Install the package via Composer:
composer require ghostcompiler/laravel-uploads php artisan install:laravel-uploads php artisan migrate
Use --force to overwrite any existing assets:
php artisan install:laravel-uploads --force
Basic Usage
Uploading a File
use GhostCompiler\LaravelUploads\Facades\Uploads; // Store a file under configured defaults $upload = Uploads::upload($request->file('avatar')); // Store to a specific directory inside the storage path $upload = Uploads::upload('avatars', $request->file('avatar'));
Uploading from a URL (Dynamic Proxy Streaming)
You can pass a remote URL string directly. The package will register the reference in the database, proxying it on-demand to hide the source URL and bypass local disk storage:
$upload = Uploads::upload('https://avatar.example.com/user123.jpg');
Resolving Secure URLs
Retrieve secure tokenized URLs to stream or preview private files:
// Generates a secure routing URL expiring in 15 minutes $url = Uploads::url($upload, 15);
Full Documentation
For detailed guides on configuration settings, Eloquent trait integrations, custom URL resolvers, image optimization pipelines, and Artisan commands, see the:
👉 Laravel Uploads Documentation
Development And Build Environment
This package was developed using ServBay as the local development environment.
Development Tool Used
- Local development tool:
ServBay - Website: www.servbay.com
ServBay your development friend
Testing And Build Machine
- Tested on:
Mac M4 - Built on:
Mac M4