Answer the question
In order to leave comments, you need to log in
Why doesn't Composer see the namespace?
Good afternoon, there is a project where you need to use Ratchet (php library for web sockets). It is downloaded via composer, I have never used it before, that's the problem. I can not understand why the namespace is not visible from another file. Here is the structure:
Composer.json:
{
"autoload": {
"psr-4": {
"App\\": "src",
}
}
...
}
namespace App;
class Chat implements MessageComponentInterface { ...
}
use App\Chat;
$chat = new Chat();
Fatal error: Uncaught Error: Class 'App\Chat' not found in D:\P\Xampp\htdocs\chat\server\src\server.php:10 Stack trace: #0 {main} thrown in D:\P\Xampp\htdocs\chat\server\src\server.php on line 10
Answer the question
In order to leave comments, you need to log in
PSR-4
"psr-4": {
"App\\": "src/"
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question