Over the past few days, some users have reported to us that they found out that the Cakephp class set could not be found.
When I run the code, I get the message “Class definitely not found”. However, use i Composer’s autoload to load the current classes.
So there are probably a few things you can do to fix “class not found” in PHP.
It’s usually just a new typo or a capital a, where the device should be lower in the namespace, or vice versa.
As Kushal Niroula mentioned below, you should always check if you’re publishing a class in the top package, so do that first!
Check the composer.json file and the full autoload path. This is usually something that the autoloader will reject, and so check that your home folder is the correct one that it is linked to.
For example, if you notice that we have set psr-4 to
"DeChampMyApp": "src/", this mightdoesn’t mean that I overwrote the “Service” folder to “src”, then the namespace would get “DeChampMyAppService”.
Make sure the namespace path is the path to .DeChampMyAppService;
Check both the namespace at the top of yours and the file, most folder locations match. Even if there are none and there are typos, some paths are case sensitive, both at the top and at the bottom. times
I’ve seen many of these issues with forgotten cases. Some
Note. Systems are not case sensitive. Therefore, the type may not apply, but it should be practiced now. I once had a serious situation where a local developer didn’t come up and it worked on my machine, but the manufacturer complained.