简体   繁体   中英

Why composer “psr-4” loading not woking in outer folder

I have this in composer:

"MyCompany\\": ["app/MyCompany/", "app/LaravelPackage/src/MyCompany/"]

and everything works fine. This also works fine:

"MyCompany\\": ["app/MyCompany/", "app/Console/../LaravelPackage/src/MyCompany/"]

Even with non existing folder and path back, works:

THIS IS PROBABY BUG. TRY IF YOU DON'T BELIEVE.

"MyCompany\\": ["app/MyCompany/", "app/Console-babababa/../LaravelPackage/src/MyCompany/"]

But if I move package out of root folder where I run composer install it not works:

"MyCompany\\": ["app/MyCompany/", "../app/LaravelPackage/src/MyCompany/"]

This should work or ?

  • I suppose your "app/Console-babababa/../LaravelPackage/src/MyCompany/" case is not a bug but a feature ;)
  • About "../app/LaravelPackage/src/MyCompany/" , it's probably just how Composer is designed.

You could have a look at this recently implemented way of defining a repository: Repositories > Hosting your own > Path . Though, it should be considered as a "last pick" solution, as it's very quick to set up but lacks flexibility.

You should consider the other options listed in the Hosting your own section. For local development, Toran Proxy is very easy to set up and use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM