Present code not autoloading, class not found (clear composer-managed code PHP cache)
- random class not autoloading PHP Drupal
- clear autoload cache PHP Drupal 8
- drupal reload php composer autoload
- reload all php libraries drupal vendor
This was the best answer it turns out (i tried it independently, but saw it on closing tabs):
https://drupal.stackexchange.com/a/253462/4195
In answer to https://drupal.stackexchange.com/questions/216222/after-upgrading-the-autoloader-is-not-working
Similar symptoms, probably different cause:
Cached autoloader misses cause failures when missed class becomes available https://www.drupal.org/project/drupal/issues/2776235
Cached ClassMap entries not reset after registering new prefix https://github.com/composer/composer/issues/5619
How one iteration manifested
I am using lando with the pantheon recipe and trying to install a composer library. The library is installed via composer, but when I try to use it in a custom Drupal module, it throws an error that the class cannot be found. Regular drupal modules required via composer work fine. Have seen something similar?
I did not know how to configure DDEV to play nice with Pantheon
And Lando has a recipe that seems to work
but this one dependency is breaking the whole thing
I see the dependency in /vendor, but it is not being loaded
I assume it has something to do with the autoloader
But no clue how to fix it
@problemhaver did you just add it? Have you tried restarting the VM? (or just the php service, then drush cr)
I will stop and start the project, but that has not been needed so far
after restarting the project I get a different error. LOL
while testing, I had bump to a newer version of the library. After downgrading to the one used in the existing site it works now. Thanks!
Having to restart the project seems like a weird solution, but I remember sometime ago I spent too much time trying to debug a problem and it was solved after restarting DDEV. Who knows.
mlncn: it’s the PHP autoload stuff, like you said. PHP is all that technically needs to be restarted.