Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Class "MyApp\Chat" not found #1044

Open
cancavid opened this issue Dec 6, 2023 · 0 comments
Open

Uncaught Error: Class "MyApp\Chat" not found #1044

cancavid opened this issue Dec 6, 2023 · 0 comments

Comments

@cancavid
Copy link

cancavid commented Dec 6, 2023

root
├── bin
│ └── server.php
├── src
│ └── Chat.php
├── composer.json
├── composer.lock
└── vendor

composer.json is

{
    "autoload": {
        "psr-4": {
            "MyApp\\": "src"
        }
    },
    "require": {
        "cboden/ratchet": "^0.4.4"
    }
}

server.php

use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use MyApp\Chat;

require dirname(__DIR__) . '/vendor/autoload.php';

$server = IoServer::factory(
  new HttpServer(
    new WsServer(
      new Chat()
    )
  ),
  8080
);

$server->run();

chat.php

namespace MyApp;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

require_once dirname(__DIR__) . '/vendor/autoload.php';

class Chat implements MessageComponentInterface {
}

I used composer update AND composer dump-autoload

but problem is continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant