laravel-ide-helper: Lumen Fresh Install - Class 'League\Flysystem\Adapter\Local' not found

Hello,

I get this error with a fresh install of Lumen (latest version - 5.7.4):

> php artisan ide-helper:generate
In FilesystemManager.php line 160:
  Class 'League\Flysystem\Adapter\Local' not found

Any idea why? No filesystem config options are set.

If I install league/flysystem package then this comes up:

> php artisan ide-helper:generate
In Alias.php line 69:
  Class App does not exist

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 17
  • Comments: 27

Commits related to this issue

Most upvoted comments

Since 2.0 came out for league/flysystem, you need to require 1.x version to access the missing adapter: composer require --dev league/flysystem ^1.0.

I got the same error. Solved it by first running:

composer require league/flysystem

Seeing that the error was for aliases, I applied the portion of the docs that referenced aliases and added a config\app.php file that looks like this:

<?php
return [
    'aliases' => [
        'App' => Illuminate\Support\Facades\App::class,
    ]
];

works!

Thanks.

Still an issue. But composer require league/flysystem still works.

composer require --dev league/flysystem ^1.0

composer require --dev “league/flysystem:^1.0”

I got the same issue on a Lumen 5.7 project, composer require league/flysystem --dev fixed it.

I think adding Flysystem to the laravel-ide-helper composer.json would be sufficient, since the package is only used as a development dependency anyway.

Same initial error, but workaround leads to

In AuthManager.php line 97:
  Auth driver [api] for guard [api] is not defined.  

EDIT: Uncommenting $app->register(App\Providers\AuthServiceProvider::class); in bootstrap/app.php seems to fix it. I’m guessing the ide-helper assumes Auth classes have been registered rather than checking first.

Polisss greets you, I took the liberty to prepare for you a complete tutorial on how to generate the ide-helper.php file.

Creating a Lumen app called: MYlumen

composer create-project --prefer-dist laravel/lumen MYlumen

Permission of facades

In the file: bootstrap/app.php

*In the section: Create The Application

Uncomment:

  • $app->withFacades();
  • $app->withEloquent();

*In the section: Register Service Providers

Add code:

// Defined "ide-helper" namespace.
if ($app->environment() !== 'production') {
    $app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}

Uncomment:

  • $app->register(App\Providers\AppServiceProvider::class);
  • $app->register(App\Providers\AuthServiceProvider::class);

Generating ide-helper

composer require --dev barryvdh/laravel-ide-helper
composer require league/flysystem ^1.1
php artisan ide-helper:generate

DONE! Have a good day 😃

But this package doesn’t need it for Laravel so IMHO it shouldn’t.

That is because Laravel already has League\Flysystem as a dependency.

You are right that it is not specifically developed for Lumen, although I think my solution is pretty elegant. I’m OK with a mention in the readme though.

Another thought – you could add it to the suggests section of composer.json as well.

Lumen 5.8 does not seem to come with flysystem as a default dependency, so needs to be added separately. The local file logging, local file caching, local sessions, I guess don’t use flysystem but just go directly to the local filesystem. This is in contrast to laravel.