- Are you chaning
class Testtoclass Whateverin a file calledTest.php? - Are you calling
composer dump-autoloadafter changing filename and class name ?
General Composer PSR-4 Problem
Hi,
first of all. It is not Laravel specific, it is a general problem. I knew composer very well (i think) and using it for a long time. But now i ran into an issue, that i can not explain myself, but i am sure, that someone here, knows what to do :)
I am on a very old project of a customer and i wanted to use composer to autoload my files. Here is the basic (relevant) structure.
/application
/application/Test.php
/application/Whatever.php
/public
/public/index.php
I configured composer with PSR-4 to use Acme\ in application/. When i have a look at the generated autoload files, everything links fine. Require the autoloader and so on.
Here is the Problem:
If i give the "Test.php" the namespace Acme and call in index.php
new \Acme\Test;
everything is working.
If the classname is NOT "Test" (for e.g. "Whatever"), it is not working. Always get the error, that the class could not be found. And now i am thinking.. "WHAAT" ? .. Really. i can choose whatever i want as name. Nothing is working. But the classname "Test" is working. Does anyone have an idea? I never had this problems before and have really no clue about it.
Please or to participate in this conversation.