Why doesn't Composer load the code base recursively?

藏色散人
Release: 2019-08-14 14:26:32
Original
1875 people have browsed it

The composer tutorial column below will explain why Composer does not load the code library recursively. I hope it will be helpful to friends in need!

Why doesn't Composer load the code base recursively?

Why does Composer not load the code base recursively?

When you use custom libraries, you may run into problems because Composer will not recursively load the requirement libraries you ask for, so you must redefine all composer.json files in these libraries .

Before detailing why this is the case, you need to understand: the main use of custom VCS and package repositories is to temporarily test something, or to Fork a project to make some improvements, and your Pull Request has not yet By Merge, etc. You shouldn't use them to track your private packs, for that matter you should look at Private Packagist to handle private packs for your company or even yourself.

There are three ways to make the dependency resolver use your custom repository:

● Read the root package's repository and get it from the defined repository All software packages resolve dependency requirements. This is the current state and it works just fine, except for the "cannot load repository recursively" limitation.

● Read the repository of the root package and initialize the resource package from the defined repos. Recursive initialization is based on the repos defined in all dependent packages and the repos defined in other packages that these dependent packages depend on. , etc., and then resolve the dependency requirements. This may work, but will severely impact the speed of initialization, as each VCS repos will take a few seconds to read. It may ultimately fail because different versions of a package may come from the same package in a package repository, but from a different dist/source. There's so much that can go wrong.

● Read the repository of the root package, then read the first-level dependencies, then read other packages that these dependent packages depend on, etc., and then parse the dependency requirements. This sounds more efficient, but still has the problems of the second solution. Because loading dependent repositories is not as easy as it sounds. You need to load the repos of all possible matching dependency packages, and the definitions of these packages may conflict with each other.

For more composer usage tutorials, please visit the composer command usage graphic tutorial column!

The above is the detailed content of Why doesn't Composer load the code base recursively?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!