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
Since 2.0 came out for
league/flysystem
, you need to require1.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:works!
Thanks.
Still an issue. But
composer require league/flysystem
still works.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
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
Permission of facades
In the file: bootstrap/app.php
*In the section: Create The Application
Uncomment:
*In the section: Register Service Providers
Add code:
Uncomment:
Generating ide-helper
DONE! Have a good day 😃
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.