How to make Laravel discover a package when running `composer dump-autoload`?
I have an issue with a some files being missing after I run composer dump-autoload. This is probably due to bad installation in the past.
Now there is no more internet connection so I can't fix it in normal ways.
This is the error:
Interface 'Psr\Http\Client\ClientInterface' not found at C:\project\vendor\guzzlehttp\guzzle\src\Client.php
I did compare the composer files before and after running composer dump-autoload and noticed it removes some lines (the same lines that throw the missing files error) in both composer/autoload_classmap.php and composer/autoload_static.php :
// autoload_classmap.php
'Psr\Http\Client\ClientInterface' => $vendorDir . '/psr/http-client/src/ClientInterface.php'`
and
// autoload_static.php
'Psr\Http\Client\ClientInterface' => __DIR__ . '/..' . '/psr/http-client/src/ClientInterface.php'`
Now I even added psr/http-client to composer.json but it didn't do anything, and I noticed that Laravel's package discovery script did not find it as well (But maybe it shouldn't because this package is a dependency of GuzzleHttp so maybe that's fine that it didn't discover it).
But using this information, is there a chance to fix it and make composer dump-autoload work and not remove the psr lines from composer files?
Update: After I manually add the two lines to the files it works again!
So why does composer dump-autoload removes these lines in the first place? I did add psr/http-client to composer.json.. or maybe that's not enough?
Update 2: I know that everything on this project was installed using composer version 1.x, and I ran the composer dump-autoload using composer 2.4. Could that also cause the problem?
Because everything looks fine besides that, I don't know why it just deletes the entries from the composer files
Please or to participate in this conversation.