Framework guides
Laravel
Configure Laravel Storage to use Quat as an S3-compatible disk.
Install
Laravel uses Flysystem. Install the S3 adapter if it is not already present:
composer require league/flysystem-aws-s3-v3
Environment
FILESYSTEM_DISK=quat
S3_ENDPOINT=https://storage.example.local
S3_ACCESS_KEY=your-access-key
S3_SECRET_KEY=your-secret-key
S3_REGION=us-east-1
S3_BUCKET=my-bucket
S3_USE_PATH_STYLE_ENDPOINT=true
Filesystem Configuration
Add a Quat disk in config/filesystems.php:
'disks' => [
'quat' => [
'driver' => 's3',
'key' => env('S3_ACCESS_KEY'),
'secret' => env('S3_SECRET_KEY'),
'region' => env('S3_REGION', 'us-east-1'),
'bucket' => env('S3_BUCKET'),
'endpoint' => env('S3_ENDPOINT'),
'use_path_style_endpoint' => env('S3_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
],
Note: Path-style endpoints are usually required for local S3-compatible storage unless your deployment has wildcard DNS and TLS configured for bucket subdomains.
Upload File
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
Route::post('/uploads', function (Request $request) {
$request->validate([
'file' => ['required', 'file', 'max:102400'],
]);
$path = $request->file('file')->store('uploads', 'quat');
return ['path' => $path];
});
Download File
use Illuminate\Support\Facades\Storage;
Route::get('/files/{path}', function (string $path) {
abort_unless(Storage::disk('quat')->exists($path), 404);
return Storage::disk('quat')->download($path);
})->where('path', '.*');
List Files
use Illuminate\Support\Facades\Storage;
$files = Storage::disk('quat')->files('uploads');
foreach ($files as $file) {
logger()->info('Quat object', ['key' => $file]);
}
Delete File
use Illuminate\Support\Facades\Storage;
Storage::disk('quat')->delete('uploads/avatar.png');
Temporary URLs
Laravel temporary URLs depend on presigned URL support from the underlying S3-compatible endpoint:
use Illuminate\Support\Facades\Storage;
$url = Storage::disk('quat')->temporaryUrl(
'uploads/avatar.png',
now()->addMinutes(15),
);
If this fails, use application-controlled download routes or a backend-generated download link from your Quat API if exposed to your application.
Queue Uploads
For large uploads or post-processing, store the uploaded file locally first, then dispatch a queue job that uploads to Quat:
Storage::disk('quat')->put(
'exports/report.csv',
fopen(storage_path('app/tmp/report.csv'), 'r'),
);
Common Laravel Issues
| Symptom | Fix |
|---|---|
Unable to write file | Set 'throw' => true, then inspect the real S3 exception. |
The bucket does not allow ACLs | Avoid ACL options unless your deployment explicitly supports them. |
SignatureDoesNotMatch | Clear config cache and verify endpoint, region, and keys. |
DNS error for bucket.storage.example.local | Enable use_path_style_endpoint. |
php artisan config:clear
php artisan cache:clear