Was this content helpful?
How could we make this article more helpful?
Laravel is validated for use with Lyve Cloud Object Storage.
To add a Lyve Cloud storage in Laravel:
composer require league/flysystem-aws-s3-v3
's3' => [ 'driver' => 's3', 'key' => env('LYVE_ACCESS_KEY_ID'), 'secret' => env('LYVE_SECRET_ACCESS_KEY'), 'region' => env('LYVE_DEFAULT_REGION'), 'bucket' => env('LYVE_BUCKET'), 'endpoint' => env('LYVE_ENDPOINT'), 'use_path_style_endpoint' => env('LYVE_USE_PATH_STYLE_ENDPOINT', false), ],
php artisan config:clear php artisan cache:clear php artisan config:cache
use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; Route::get('/upload', function () { return view('upload'); }); Route::post('/upload', function (Request $request) { $path = $request->file('file')->store('uploads', 's3'); $url = Storage::disk('s3')->url($path); return "File uploaded successfully: <a href="$url">$url</a>"; });
Route::get('/files', function () { $files = Storage::disk('s3')->allFiles(); return response()->json($files); });
Route::get('/download/{filename}', function ($filename) { return Storage::disk('s3')->download("uploads/$filename"); });