Home  >  Article  >  Development Tools  >  The concept of extension package source repository

The concept of extension package source repository

藏色散人
藏色散人Original
2019-10-11 14:07:492793browse

The following column of composer tutorial will introduce you to the concepts of instruction packages and warehouses. I hope it will be helpful to friends in need!

The concept of extension package source repository

Concepts

Before we understand the different types of repositories that exist, we need to understand some basic concepts of Composer construction.

Package

Composer is a dependency manager. It is able to install packages locally. A package is essentially a directory that contains a series of source files. Generally, the files in a package are mainly a bunch of PHP code files, but in theory, a package can include any type of files. One of the files is the file in the package used to describe the name and version information of the package. The name and version uniquely identify the package.

In fact, Composer internally considers each version to be an independent package. Although this is not important when using Composer to manage dependencies, it is important when you want to change something in the package or do some customization. These are important when defining options.

In addition, in addition to the name and version information, there are some other useful metadata. The most closely related information when installing a package is the definition of the package source, which is used to tell where to obtain the actual content of the package. There are two types of sources: dist and source.

Dist: The dist source package is a packaged distribution version. Usually a released stable version.

Source: source packages are often used for development. Usually a source code repository such as git. When you want to modify the downloaded package, you can choose to use this source.

Packages can provide either source option, or both. Which one is ultimately selected depends on certain factors, such as user-supplied specific options and the package's stability flag.

Warehouse

The warehouse is the source of the package. It provides a list of packages and versions. Composer searches all repository sources defined in your configuration to find the packages needed in your project and import them.

Composer uses Packagist as the global default search repository. Of course, you can also add additional warehouse source configuration in your project configuration file - composer.json.

All configuration information for the warehouse source is only valid in the source package (root package), and the configuration information for the warehouse source in the package that the package depends on will no longer be used by Composer as a target to find the package. Warehouse basis. You can read FAQ entry to learn more about the specific reasons.

The above is the detailed content of The concept of extension package source repository. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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