php - namespace autoloading with composer and PSR-0 -


I want to implement Nom place Auto loading with Musician and PSR-0, and I do not know why this does not work was done.

My file structure is:

  src | App | World | World .php | User | User.php vendor test.php composer.json  

in World.php

  & lt ;? Php namespace world; Class world {public ceremony hello () {come back "hello world"; }}? & Gt;  User.php   
  & lt; Php namespace user  

; Class user {public function hello () {return "hello user"; }}? & Gt; <">" <">" "" "Src / app"}}}

and when I call it test.php Check in:

  & lt; Php is required 'vendor / autoload.php'; Class MyWorld {public function testhello () {$ w = New My Book: Echo $ w-> Hello (); $ U = new My user \ user (); Resonate $ u- & gt; Hello (); }} $ M = New Myworld (); $ M- & gt; Testhello (); ? & Gt;  

I get this error:

Fatal error: Class 'my user' user 'did not get'

Fatal error: Class 'My World World' was not found

What am I missing? Any advice would be welcome! Thank you.

No namespace part of your definitions is "mine".

  namespace users; Class user {...}  

This class name is \ user \ user , no \ my \ user \ user .

The same applies to \ world \ world .

As a result, the namespace definition in Composer is incorrect. You will need two definitions for both user and world , both in the same directory:

  {"autoload": {" Psr -0 ": {" user \\ ":" src / app "," world \\ ":" src / app "}}}  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -