Ratchet: Hello World! tutorial can't find class MyApp/Chat

Created on 23 Oct 2014  ยท  7Comments  ยท  Source: ratchetphp/Ratchet

Heyo,
I have followed every step of the Hello World! tutorial, but can't get past Instantiation. I run it through the command prompt and the following error appears:

php bin\chat-server.php
Fatal error: Class 'MyApp\Chat' not found in C:\path\to\install\betabin\chat-server.php on line 8

File tree and composer.json can be found here: http://pastebin.com/xEDwVBg0
Just wondering if I missed something or interpreted something wrong. Thank you~

question

All 7 comments

Are you including vendor/autoload.php in chat-server.php?

This? require dirname(DIR) . '/vendor/autoload.php'; If so, yes.

Can you post the code to your chat-server.php and Chat.php?

I got the same error..

according to this: http://stackoverflow.com/questions/16868942/ratchet-basic-chat-application-giving-error-failed-opening-required

"php composer.phar update" helped

btw someone should write exactly filestructure to the hello world app, it is not explicitly given where should be chat-server located..
it should be easy to write down:

appfolder/composer.json
appfolder/bin/chat-server.php
appfolder/src/MyApp/Chat.php

btw, i am referring to tutorial from here: http://socketo.me/docs/hello-world

Thank you scholtz, the update command fixed it. I might suggest you add a little note about using the update command after editing composer.json as well.

I'm out of town for four days. When I get back I'll update the website documentation with the recently revised way (composer require cboden/ratchet) to install a package as well as a tree structure.

Thanks a lot. I have the same problem. When I execute php composer.phar update, I fixed it.

My folder tree:
โžœ ws tree -L 3
.
โ”œโ”€โ”€ bin
โ”‚ย ย  โ””โ”€โ”€ chat-server.php
โ”œโ”€โ”€ composer.json
โ”œโ”€โ”€ composer.lock
โ”œโ”€โ”€ composer.phar
โ”œโ”€โ”€ MyApp.php
โ”œโ”€โ”€ src
โ”‚ย ย  โ””โ”€โ”€ MyApp
โ”‚ย ย  โ””โ”€โ”€ Chat.php
โ””โ”€โ”€ vendor
โ”œโ”€โ”€ autoload.php
โ”œโ”€โ”€ cboden
โ”‚ย ย  โ””โ”€โ”€ ratchet
โ”œโ”€โ”€ composer
โ”‚ย ย  โ”œโ”€โ”€ autoload_classmap.php
โ”‚ย ย  โ”œโ”€โ”€ autoload_namespaces.php
โ”‚ย ย  โ”œโ”€โ”€ autoload_psr4.php
โ”‚ย ย  โ”œโ”€โ”€ autoload_real.php
โ”‚ย ย  โ”œโ”€โ”€ ClassLoader.php
โ”‚ย ย  โ””โ”€โ”€ installed.json
โ”œโ”€โ”€ evenement
โ”‚ย ย  โ””โ”€โ”€ evenement
โ”œโ”€โ”€ guzzle
โ”‚ย ย  โ”œโ”€โ”€ common
โ”‚ย ย  โ”œโ”€โ”€ http
โ”‚ย ย  โ”œโ”€โ”€ parser
โ”‚ย ย  โ””โ”€โ”€ stream
โ”œโ”€โ”€ react
โ”‚ย ย  โ”œโ”€โ”€ event-loop
โ”‚ย ย  โ”œโ”€โ”€ socket
โ”‚ย ย  โ””โ”€โ”€ stream
โ””โ”€โ”€ symfony
โ”œโ”€โ”€ event-dispatcher
โ”œโ”€โ”€ http-foundation
โ””โ”€โ”€ routing

22 directories, 13 files

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rukavina picture rukavina  ยท  4Comments

Opice picture Opice  ยท  4Comments

piotrchludzinski picture piotrchludzinski  ยท  5Comments

tasaif picture tasaif  ยท  6Comments

elovin picture elovin  ยท  3Comments