Composer PSR-4 autoloading “class not found” debug











up vote
2
down vote

favorite












Yes another question about the "class not found" error. Either I am missing something, or I misunderstood the PSR-4 logic.



My composer library directory sturcture:



"Scanner" => "src" => "Test.php"



Test.php



namespace MyNS;

class Test
{
}


composer.json



"autoload": {
"psr-4": {
"MyNS\": "src/"
},
}


So, now I load the library in my project with composer and try using it.



require_once("../vendor/autoload.php");

$test = new MyNSTest();


Which always results in




"Fatal error: Uncaught Error: Class 'MyNSTest' not found."




. What am I missing? I am staring at this for days now. I have changed folders, I have changed folder names, I have changed uppper to lower and vise versa. Nothing seems to work.



I am using PHP 7.2.2 and Composer version 1.2.2



Even tried this:



require_once("../vendor/autoload.php");

use MyNSTest;

$scanner = new Test();


Update



I debugt the Composer ClassLoader.php file (findFileWithExtension($class, $ext)) method and apparently my files are never loaded because I get put an echo "Done" and a die(); at the end of this method which means the file is not found and thus not loaded. What is wrong with my composer.json?



{
"name": "test/test",
"type": "library",
"description": "",
"keywords": ["php"],
"homepage": "",
"license": "MIT",
"authors": [
{
"name": "",
"email": "",
"homepage": "",
"role": ""
}
],
"require": {
"php": ">=7.2.2"
},
"autoload": {
"psr-4": {
"MyNS\": "src/"
}
}
}









share|improve this question
























  • Looking at the provided namespace, your path should be src/PSR4/ and not src/ and the namespace of class Test is MyNSPSR4 and not MyNS alone.
    – revo
    Nov 18 at 8:01












  • I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tackt. Still not working.
    – Digital Human
    Nov 18 at 8:11












  • Did you do composer dump-autoload after making changes?
    – revo
    Nov 18 at 8:14










  • It feels like that the autoloader isn't working at all. It doesn't seem to make a difference what names I use, what folders I use. I tried removing namespaces in both the classes and the composer.json. Even that didn't work. It still returns 'Class not found'.
    – Digital Human
    Nov 18 at 8:17












  • @revo yes everytime. Is there a way to debug what 'autoload' is exactly doing? In what folder it looks for what files for example?
    – Digital Human
    Nov 18 at 8:26















up vote
2
down vote

favorite












Yes another question about the "class not found" error. Either I am missing something, or I misunderstood the PSR-4 logic.



My composer library directory sturcture:



"Scanner" => "src" => "Test.php"



Test.php



namespace MyNS;

class Test
{
}


composer.json



"autoload": {
"psr-4": {
"MyNS\": "src/"
},
}


So, now I load the library in my project with composer and try using it.



require_once("../vendor/autoload.php");

$test = new MyNSTest();


Which always results in




"Fatal error: Uncaught Error: Class 'MyNSTest' not found."




. What am I missing? I am staring at this for days now. I have changed folders, I have changed folder names, I have changed uppper to lower and vise versa. Nothing seems to work.



I am using PHP 7.2.2 and Composer version 1.2.2



Even tried this:



require_once("../vendor/autoload.php");

use MyNSTest;

$scanner = new Test();


Update



I debugt the Composer ClassLoader.php file (findFileWithExtension($class, $ext)) method and apparently my files are never loaded because I get put an echo "Done" and a die(); at the end of this method which means the file is not found and thus not loaded. What is wrong with my composer.json?



{
"name": "test/test",
"type": "library",
"description": "",
"keywords": ["php"],
"homepage": "",
"license": "MIT",
"authors": [
{
"name": "",
"email": "",
"homepage": "",
"role": ""
}
],
"require": {
"php": ">=7.2.2"
},
"autoload": {
"psr-4": {
"MyNS\": "src/"
}
}
}









share|improve this question
























  • Looking at the provided namespace, your path should be src/PSR4/ and not src/ and the namespace of class Test is MyNSPSR4 and not MyNS alone.
    – revo
    Nov 18 at 8:01












  • I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tackt. Still not working.
    – Digital Human
    Nov 18 at 8:11












  • Did you do composer dump-autoload after making changes?
    – revo
    Nov 18 at 8:14










  • It feels like that the autoloader isn't working at all. It doesn't seem to make a difference what names I use, what folders I use. I tried removing namespaces in both the classes and the composer.json. Even that didn't work. It still returns 'Class not found'.
    – Digital Human
    Nov 18 at 8:17












  • @revo yes everytime. Is there a way to debug what 'autoload' is exactly doing? In what folder it looks for what files for example?
    – Digital Human
    Nov 18 at 8:26













up vote
2
down vote

favorite









up vote
2
down vote

favorite











Yes another question about the "class not found" error. Either I am missing something, or I misunderstood the PSR-4 logic.



My composer library directory sturcture:



"Scanner" => "src" => "Test.php"



Test.php



namespace MyNS;

class Test
{
}


composer.json



"autoload": {
"psr-4": {
"MyNS\": "src/"
},
}


So, now I load the library in my project with composer and try using it.



require_once("../vendor/autoload.php");

$test = new MyNSTest();


Which always results in




"Fatal error: Uncaught Error: Class 'MyNSTest' not found."




. What am I missing? I am staring at this for days now. I have changed folders, I have changed folder names, I have changed uppper to lower and vise versa. Nothing seems to work.



I am using PHP 7.2.2 and Composer version 1.2.2



Even tried this:



require_once("../vendor/autoload.php");

use MyNSTest;

$scanner = new Test();


Update



I debugt the Composer ClassLoader.php file (findFileWithExtension($class, $ext)) method and apparently my files are never loaded because I get put an echo "Done" and a die(); at the end of this method which means the file is not found and thus not loaded. What is wrong with my composer.json?



{
"name": "test/test",
"type": "library",
"description": "",
"keywords": ["php"],
"homepage": "",
"license": "MIT",
"authors": [
{
"name": "",
"email": "",
"homepage": "",
"role": ""
}
],
"require": {
"php": ">=7.2.2"
},
"autoload": {
"psr-4": {
"MyNS\": "src/"
}
}
}









share|improve this question















Yes another question about the "class not found" error. Either I am missing something, or I misunderstood the PSR-4 logic.



My composer library directory sturcture:



"Scanner" => "src" => "Test.php"



Test.php



namespace MyNS;

class Test
{
}


composer.json



"autoload": {
"psr-4": {
"MyNS\": "src/"
},
}


So, now I load the library in my project with composer and try using it.



require_once("../vendor/autoload.php");

$test = new MyNSTest();


Which always results in




"Fatal error: Uncaught Error: Class 'MyNSTest' not found."




. What am I missing? I am staring at this for days now. I have changed folders, I have changed folder names, I have changed uppper to lower and vise versa. Nothing seems to work.



I am using PHP 7.2.2 and Composer version 1.2.2



Even tried this:



require_once("../vendor/autoload.php");

use MyNSTest;

$scanner = new Test();


Update



I debugt the Composer ClassLoader.php file (findFileWithExtension($class, $ext)) method and apparently my files are never loaded because I get put an echo "Done" and a die(); at the end of this method which means the file is not found and thus not loaded. What is wrong with my composer.json?



{
"name": "test/test",
"type": "library",
"description": "",
"keywords": ["php"],
"homepage": "",
"license": "MIT",
"authors": [
{
"name": "",
"email": "",
"homepage": "",
"role": ""
}
],
"require": {
"php": ">=7.2.2"
},
"autoload": {
"psr-4": {
"MyNS\": "src/"
}
}
}






php composer-php autoloader psr-4






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 at 16:31

























asked Nov 18 at 7:56









Digital Human

569620




569620












  • Looking at the provided namespace, your path should be src/PSR4/ and not src/ and the namespace of class Test is MyNSPSR4 and not MyNS alone.
    – revo
    Nov 18 at 8:01












  • I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tackt. Still not working.
    – Digital Human
    Nov 18 at 8:11












  • Did you do composer dump-autoload after making changes?
    – revo
    Nov 18 at 8:14










  • It feels like that the autoloader isn't working at all. It doesn't seem to make a difference what names I use, what folders I use. I tried removing namespaces in both the classes and the composer.json. Even that didn't work. It still returns 'Class not found'.
    – Digital Human
    Nov 18 at 8:17












  • @revo yes everytime. Is there a way to debug what 'autoload' is exactly doing? In what folder it looks for what files for example?
    – Digital Human
    Nov 18 at 8:26


















  • Looking at the provided namespace, your path should be src/PSR4/ and not src/ and the namespace of class Test is MyNSPSR4 and not MyNS alone.
    – revo
    Nov 18 at 8:01












  • I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tackt. Still not working.
    – Digital Human
    Nov 18 at 8:11












  • Did you do composer dump-autoload after making changes?
    – revo
    Nov 18 at 8:14










  • It feels like that the autoloader isn't working at all. It doesn't seem to make a difference what names I use, what folders I use. I tried removing namespaces in both the classes and the composer.json. Even that didn't work. It still returns 'Class not found'.
    – Digital Human
    Nov 18 at 8:17












  • @revo yes everytime. Is there a way to debug what 'autoload' is exactly doing? In what folder it looks for what files for example?
    – Digital Human
    Nov 18 at 8:26
















Looking at the provided namespace, your path should be src/PSR4/ and not src/ and the namespace of class Test is MyNSPSR4 and not MyNS alone.
– revo
Nov 18 at 8:01






Looking at the provided namespace, your path should be src/PSR4/ and not src/ and the namespace of class Test is MyNSPSR4 and not MyNS alone.
– revo
Nov 18 at 8:01














I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tackt. Still not working.
– Digital Human
Nov 18 at 8:11






I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tackt. Still not working.
– Digital Human
Nov 18 at 8:11














Did you do composer dump-autoload after making changes?
– revo
Nov 18 at 8:14




Did you do composer dump-autoload after making changes?
– revo
Nov 18 at 8:14












It feels like that the autoloader isn't working at all. It doesn't seem to make a difference what names I use, what folders I use. I tried removing namespaces in both the classes and the composer.json. Even that didn't work. It still returns 'Class not found'.
– Digital Human
Nov 18 at 8:17






It feels like that the autoloader isn't working at all. It doesn't seem to make a difference what names I use, what folders I use. I tried removing namespaces in both the classes and the composer.json. Even that didn't work. It still returns 'Class not found'.
– Digital Human
Nov 18 at 8:17














@revo yes everytime. Is there a way to debug what 'autoload' is exactly doing? In what folder it looks for what files for example?
– Digital Human
Nov 18 at 8:26




@revo yes everytime. Is there a way to debug what 'autoload' is exactly doing? In what folder it looks for what files for example?
– Digital Human
Nov 18 at 8:26












2 Answers
2






active

oldest

votes

















up vote
0
down vote













i think the problem is in your namespace declaration



you calling the class from MyNS but class namespace is namespace MyNSPSR4;



require_once("../vendor/autoload.php");

$test = new MyNSTest();

// it should be new MyNSPSR4Test();


and make sure, your class file in same directory which you mentioned in composer autoload file



also you have to run dump-autoload command for any change in classnames



you can visit for this autoload feature






share|improve this answer























  • I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tact. Still not working.
    – Digital Human
    Nov 18 at 8:13










  • after changing namespace did you run dump-autoload ? more details: getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
    – Emtiaz Zahid
    Nov 18 at 8:37


















up vote
0
down vote













To debug what is happening open ClassLoader.php file then go where findFileWithExtension() method is defined to add an echo statement:



# vendor/composer/ClassLoader.php:386

foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
// Add this line
echo $file, PHP_EOL;
}


Do not do composer dumpautoload after you manually modified above file until we are done.



Now by executing your PHP file you will see something similar to this at the very beginning of output:



path/to/project/vendor/composer/../../src/Test.php


Which is:



path/to/project/src/Test.php


So this is the file that composer is looking for and should contain something like this:



namespace MyNS;

class Test { }


If there is an issue in including the file then it means you have to care about three things:




  1. Path and filename

  2. Namespace used in file

  3. Class name used in file (class name should be the same as filename)






share|improve this answer























  • Thanks! I will do some testing later today. I'll keep you guys posted :)
    – Digital Human
    Nov 18 at 10:06










  • 0 (zero) output. As my gut feeling said. It doesn't do anything with the psr-4 autoload.
    – Digital Human
    Nov 18 at 16:19










  • So it never gets loaded by PSR-4. That is the conclusion. I debuged the entire findFileWithExtenson($class, $ext) method in the ClassLoader.php and it reaches the end of the method.
    – Digital Human
    Nov 18 at 16:28










  • Please open up autoload_psr4.php and see the contents. Do you see a line corresponding to MyNS?
    – revo
    Nov 18 at 18:09










  • No I don't see anything except this: ` $vendorDir = dirname(dirname(FILE)); $baseDir = dirname($vendorDir); return array( ); `
    – Digital Human
    Nov 19 at 7:12











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53358919%2fcomposer-psr-4-autoloading-class-not-found-debug%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













i think the problem is in your namespace declaration



you calling the class from MyNS but class namespace is namespace MyNSPSR4;



require_once("../vendor/autoload.php");

$test = new MyNSTest();

// it should be new MyNSPSR4Test();


and make sure, your class file in same directory which you mentioned in composer autoload file



also you have to run dump-autoload command for any change in classnames



you can visit for this autoload feature






share|improve this answer























  • I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tact. Still not working.
    – Digital Human
    Nov 18 at 8:13










  • after changing namespace did you run dump-autoload ? more details: getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
    – Emtiaz Zahid
    Nov 18 at 8:37















up vote
0
down vote













i think the problem is in your namespace declaration



you calling the class from MyNS but class namespace is namespace MyNSPSR4;



require_once("../vendor/autoload.php");

$test = new MyNSTest();

// it should be new MyNSPSR4Test();


and make sure, your class file in same directory which you mentioned in composer autoload file



also you have to run dump-autoload command for any change in classnames



you can visit for this autoload feature






share|improve this answer























  • I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tact. Still not working.
    – Digital Human
    Nov 18 at 8:13










  • after changing namespace did you run dump-autoload ? more details: getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
    – Emtiaz Zahid
    Nov 18 at 8:37













up vote
0
down vote










up vote
0
down vote









i think the problem is in your namespace declaration



you calling the class from MyNS but class namespace is namespace MyNSPSR4;



require_once("../vendor/autoload.php");

$test = new MyNSTest();

// it should be new MyNSPSR4Test();


and make sure, your class file in same directory which you mentioned in composer autoload file



also you have to run dump-autoload command for any change in classnames



you can visit for this autoload feature






share|improve this answer














i think the problem is in your namespace declaration



you calling the class from MyNS but class namespace is namespace MyNSPSR4;



require_once("../vendor/autoload.php");

$test = new MyNSTest();

// it should be new MyNSPSR4Test();


and make sure, your class file in same directory which you mentioned in composer autoload file



also you have to run dump-autoload command for any change in classnames



you can visit for this autoload feature







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 18 at 8:38

























answered Nov 18 at 8:02









Emtiaz Zahid

897515




897515












  • I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tact. Still not working.
    – Digital Human
    Nov 18 at 8:13










  • after changing namespace did you run dump-autoload ? more details: getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
    – Emtiaz Zahid
    Nov 18 at 8:37


















  • I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tact. Still not working.
    – Digital Human
    Nov 18 at 8:13










  • after changing namespace did you run dump-autoload ? more details: getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
    – Emtiaz Zahid
    Nov 18 at 8:37
















I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tact. Still not working.
– Digital Human
Nov 18 at 8:13




I removed PSR4 in the namespace (as mentioned) . Not working. I also moved Test.php to folder src/PSR4 and left namespace in tact. Still not working.
– Digital Human
Nov 18 at 8:13












after changing namespace did you run dump-autoload ? more details: getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
– Emtiaz Zahid
Nov 18 at 8:37




after changing namespace did you run dump-autoload ? more details: getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
– Emtiaz Zahid
Nov 18 at 8:37












up vote
0
down vote













To debug what is happening open ClassLoader.php file then go where findFileWithExtension() method is defined to add an echo statement:



# vendor/composer/ClassLoader.php:386

foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
// Add this line
echo $file, PHP_EOL;
}


Do not do composer dumpautoload after you manually modified above file until we are done.



Now by executing your PHP file you will see something similar to this at the very beginning of output:



path/to/project/vendor/composer/../../src/Test.php


Which is:



path/to/project/src/Test.php


So this is the file that composer is looking for and should contain something like this:



namespace MyNS;

class Test { }


If there is an issue in including the file then it means you have to care about three things:




  1. Path and filename

  2. Namespace used in file

  3. Class name used in file (class name should be the same as filename)






share|improve this answer























  • Thanks! I will do some testing later today. I'll keep you guys posted :)
    – Digital Human
    Nov 18 at 10:06










  • 0 (zero) output. As my gut feeling said. It doesn't do anything with the psr-4 autoload.
    – Digital Human
    Nov 18 at 16:19










  • So it never gets loaded by PSR-4. That is the conclusion. I debuged the entire findFileWithExtenson($class, $ext) method in the ClassLoader.php and it reaches the end of the method.
    – Digital Human
    Nov 18 at 16:28










  • Please open up autoload_psr4.php and see the contents. Do you see a line corresponding to MyNS?
    – revo
    Nov 18 at 18:09










  • No I don't see anything except this: ` $vendorDir = dirname(dirname(FILE)); $baseDir = dirname($vendorDir); return array( ); `
    – Digital Human
    Nov 19 at 7:12















up vote
0
down vote













To debug what is happening open ClassLoader.php file then go where findFileWithExtension() method is defined to add an echo statement:



# vendor/composer/ClassLoader.php:386

foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
// Add this line
echo $file, PHP_EOL;
}


Do not do composer dumpautoload after you manually modified above file until we are done.



Now by executing your PHP file you will see something similar to this at the very beginning of output:



path/to/project/vendor/composer/../../src/Test.php


Which is:



path/to/project/src/Test.php


So this is the file that composer is looking for and should contain something like this:



namespace MyNS;

class Test { }


If there is an issue in including the file then it means you have to care about three things:




  1. Path and filename

  2. Namespace used in file

  3. Class name used in file (class name should be the same as filename)






share|improve this answer























  • Thanks! I will do some testing later today. I'll keep you guys posted :)
    – Digital Human
    Nov 18 at 10:06










  • 0 (zero) output. As my gut feeling said. It doesn't do anything with the psr-4 autoload.
    – Digital Human
    Nov 18 at 16:19










  • So it never gets loaded by PSR-4. That is the conclusion. I debuged the entire findFileWithExtenson($class, $ext) method in the ClassLoader.php and it reaches the end of the method.
    – Digital Human
    Nov 18 at 16:28










  • Please open up autoload_psr4.php and see the contents. Do you see a line corresponding to MyNS?
    – revo
    Nov 18 at 18:09










  • No I don't see anything except this: ` $vendorDir = dirname(dirname(FILE)); $baseDir = dirname($vendorDir); return array( ); `
    – Digital Human
    Nov 19 at 7:12













up vote
0
down vote










up vote
0
down vote









To debug what is happening open ClassLoader.php file then go where findFileWithExtension() method is defined to add an echo statement:



# vendor/composer/ClassLoader.php:386

foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
// Add this line
echo $file, PHP_EOL;
}


Do not do composer dumpautoload after you manually modified above file until we are done.



Now by executing your PHP file you will see something similar to this at the very beginning of output:



path/to/project/vendor/composer/../../src/Test.php


Which is:



path/to/project/src/Test.php


So this is the file that composer is looking for and should contain something like this:



namespace MyNS;

class Test { }


If there is an issue in including the file then it means you have to care about three things:




  1. Path and filename

  2. Namespace used in file

  3. Class name used in file (class name should be the same as filename)






share|improve this answer














To debug what is happening open ClassLoader.php file then go where findFileWithExtension() method is defined to add an echo statement:



# vendor/composer/ClassLoader.php:386

foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
// Add this line
echo $file, PHP_EOL;
}


Do not do composer dumpautoload after you manually modified above file until we are done.



Now by executing your PHP file you will see something similar to this at the very beginning of output:



path/to/project/vendor/composer/../../src/Test.php


Which is:



path/to/project/src/Test.php


So this is the file that composer is looking for and should contain something like this:



namespace MyNS;

class Test { }


If there is an issue in including the file then it means you have to care about three things:




  1. Path and filename

  2. Namespace used in file

  3. Class name used in file (class name should be the same as filename)







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 18 at 9:27

























answered Nov 18 at 9:22









revo

31.4k124679




31.4k124679












  • Thanks! I will do some testing later today. I'll keep you guys posted :)
    – Digital Human
    Nov 18 at 10:06










  • 0 (zero) output. As my gut feeling said. It doesn't do anything with the psr-4 autoload.
    – Digital Human
    Nov 18 at 16:19










  • So it never gets loaded by PSR-4. That is the conclusion. I debuged the entire findFileWithExtenson($class, $ext) method in the ClassLoader.php and it reaches the end of the method.
    – Digital Human
    Nov 18 at 16:28










  • Please open up autoload_psr4.php and see the contents. Do you see a line corresponding to MyNS?
    – revo
    Nov 18 at 18:09










  • No I don't see anything except this: ` $vendorDir = dirname(dirname(FILE)); $baseDir = dirname($vendorDir); return array( ); `
    – Digital Human
    Nov 19 at 7:12


















  • Thanks! I will do some testing later today. I'll keep you guys posted :)
    – Digital Human
    Nov 18 at 10:06










  • 0 (zero) output. As my gut feeling said. It doesn't do anything with the psr-4 autoload.
    – Digital Human
    Nov 18 at 16:19










  • So it never gets loaded by PSR-4. That is the conclusion. I debuged the entire findFileWithExtenson($class, $ext) method in the ClassLoader.php and it reaches the end of the method.
    – Digital Human
    Nov 18 at 16:28










  • Please open up autoload_psr4.php and see the contents. Do you see a line corresponding to MyNS?
    – revo
    Nov 18 at 18:09










  • No I don't see anything except this: ` $vendorDir = dirname(dirname(FILE)); $baseDir = dirname($vendorDir); return array( ); `
    – Digital Human
    Nov 19 at 7:12
















Thanks! I will do some testing later today. I'll keep you guys posted :)
– Digital Human
Nov 18 at 10:06




Thanks! I will do some testing later today. I'll keep you guys posted :)
– Digital Human
Nov 18 at 10:06












0 (zero) output. As my gut feeling said. It doesn't do anything with the psr-4 autoload.
– Digital Human
Nov 18 at 16:19




0 (zero) output. As my gut feeling said. It doesn't do anything with the psr-4 autoload.
– Digital Human
Nov 18 at 16:19












So it never gets loaded by PSR-4. That is the conclusion. I debuged the entire findFileWithExtenson($class, $ext) method in the ClassLoader.php and it reaches the end of the method.
– Digital Human
Nov 18 at 16:28




So it never gets loaded by PSR-4. That is the conclusion. I debuged the entire findFileWithExtenson($class, $ext) method in the ClassLoader.php and it reaches the end of the method.
– Digital Human
Nov 18 at 16:28












Please open up autoload_psr4.php and see the contents. Do you see a line corresponding to MyNS?
– revo
Nov 18 at 18:09




Please open up autoload_psr4.php and see the contents. Do you see a line corresponding to MyNS?
– revo
Nov 18 at 18:09












No I don't see anything except this: ` $vendorDir = dirname(dirname(FILE)); $baseDir = dirname($vendorDir); return array( ); `
– Digital Human
Nov 19 at 7:12




No I don't see anything except this: ` $vendorDir = dirname(dirname(FILE)); $baseDir = dirname($vendorDir); return array( ); `
– Digital Human
Nov 19 at 7:12


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53358919%2fcomposer-psr-4-autoloading-class-not-found-debug%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin