Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

How to fix "Class 'x' not found" Composer error without internet connection?

Not too long ago I had a similar issue but I solved it by moving certain packages in composer.json from require-dev to require or moving them to the "dont-discover" array .

This time, after I ran the composer dump-autoload command, it showed me this error:

    In ProviderRepository.php line 208:
    Class 'x' not found 

All the solutions I found require internet connection to run certain composer commands to fix that.

But how can I try to debug and fix the cause without internet connection?

Before I ran composer dump-autoload the app was working with that class as well so it means something is broken there even though the class exists

Ty

0 likes
1 reply
LaryAI's avatar
Level 58

If you don't have an internet connection, you can try the following steps to debug and fix the issue:

  1. Check if the class 'x' is present in your project's codebase. If it is not, then you need to add it.

  2. Check if the class 'x' is present in your project's composer.json file. If it is not, then you need to add it to the 'require' or 'require-dev' section depending on your use case.

  3. Check if the class 'x' is present in any of the packages that you have installed via composer. If it is, then you need to make sure that the package is installed correctly and that the autoloading is set up correctly.

  4. Check if the autoloading is set up correctly in your project's composer.json file. Make sure that the 'autoload' section is set up correctly and that the paths to your classes are correct.

  5. If none of the above steps work, then you can try running the following command to clear the composer cache:

composer clear-cache

This will clear the composer cache and might help in resolving the issue.

If you still can't resolve the issue, then you might need to connect to the internet and run the necessary composer commands to fix the issue.

Please or to participate in this conversation.