Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hereblur's avatar

Need help on FileSystem/Storage

Hi, I'm very new to Lumen/Laravel. and need some help.

I'm just created the new project and following this: https://laravel.com/docs/5.2/filesystem#configuration

But I'm keep getting "Class Storage not found"

Here's my controller.

<?php namespace App\Http\Controllers;

use Storage;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class UploadController extends Controller
{
    public function __construct()
    {
    }
    public function upload(Request $request){
        Storage::disk( "local" );
        return "ok";
    }
}

I did the

composer require league/flysystem
composer require league/flysystem-aws-s3-v3

And toggle the $app->withFacades(); doesn't help. User \Storage::disk doesn't help.

Any idea what I'm missing? What should I do.?

Keep getting this.

FatalErrorException in UploadController.php line 12:
Class 'Storage' not found
1. in UploadController.php line 12
2. at Application->handleShutdown() in RegistersExceptionHandlers.php line 55
3. at Application->Laravel\Lumen\Concerns\{closure}()
0 likes
3 replies
vladv's avatar

You need to add in bootstrap/app.php

$app->singleton('filesystem', function ($app) {
    return $app->loadComponent('filesystems', 'Illuminate\Filesystem\FilesystemServiceProvider', 'filesystem');
});

And in your controller:

use Illuminate\Support\Facades\Storage;
2 likes

Please or to participate in this conversation.