简体   繁体   中英

Composer dependency and redundancy challenge

I have a complicated Composer dependency challenge.

(1) Imagine a fictional library L, loaded from a Satis repo.

(2) Imagine project A, consisting of various PHP libraries, classes and "application" (primary web) php files.

One of the classes is using library L by require_once() + composer autoload.

Everything fine so far.

(3) Now imagine project B, using library L as well by composer and autoload, but also using parts of project A by require_once() single classes or function files.

Now I have a conflict of two composer autoload functionalities resulting in library L getting loaded two times (with errors, of course)

Do you see any chance for resolving that without having a "inclusion guard" in library L (which I could influence, but do not want to)?

The solution should be not to use require or include anymore, as this leads to the given problems. Why is there any reason to mix this with an autoloader anyways?

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