external classes and PHP files in Laravel - Class not found
I have two php files and I already created a folder called "ExternalClasses" and added the file to that folder.
In my php file, I add this line
namespace App\ExternalClasses;
and in my controller I add this line
use App\ExternalClasses\CCheckMail;
and this is how I use it:
$pricesClass = new CCheckMail();
$email2 = ['[email protected]'];
$prices = $pricesClass->execute ($email2);
return view('pages.home', compact('prices'));
but it gave me an error:
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Class 'App\ExternalClasses\CCheckMail' not found
If you are autoloading using psr-4, check to see whether the App folder is being autoloaded in your composer.json file in its entirety. For example, in my own projects I have: