lumenilluminatelumen-11

Unresolvable dependency resolving in class FilesystemManager


I have a Lumen 11 application and am I trying to inject the FilesystemManager manager, like this:

class CreateTaskAction
{
    public function __construct(
        protected FilesystemManager $storage,

Unfortunately, it results in this error:

Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Filesystem\FilesystemManager

Solution

  • In newer versions of Laravel components, you need set up an alias in your bootstrap/app.php:

    $app->alias('filesystem', FilesystemManager::class);
    

    You can find the list of all possible aliases in Application->registerCoreContainerAliases