laravel class not found (works on localhost but not on DO server)

Most probably (I'm pretty sure) your local environment is Windows and live server is Linux. So if the class company class file is used as company.php on local server then it's same Company.php on local server but as Linux follows case sensitive rules so it reads the company.php and Company.php as two different files.

So, if you have file name used Company.php then make sure you are refering the class using same case as Company not company (lower), in windows c and C doesn't matter but on Linux/Unix it does because of it's case sensitive nature.


I have faced the same problem when I added/created a new model class called Follower_Group in a project I worked on, and after some search I came to a solution that worked pretty well in my case. Try this:

  1. Execute the command composer dump-autoload in your local machine's terminal.
  2. Re-upload these 2 folders /bootstrap and /vendor/composer from your local machine to your server.

In case you are using git, and you want Git to be case sensitive, adjust its configs:

Just use the following command for the current repository:

git config core.ignorecase false

For global setting:

git config --global core.ignorecase false