因为 Composer 的内容比较少,所以我们就对照英文版本的内容进行排序

This commit is contained in:
YuCheng Hu 2024-04-08 22:11:25 -04:00
parent d34f16090a
commit 6384707a14
35 changed files with 28 additions and 28 deletions

View File

@ -110,7 +110,7 @@ hg) 的信息推断出包的版本,因此你不必手动指明版本号,并
它表示一个包版本的别名。例如,你可以为 `dev-master` 设置别名 `1.0.x-dev`,这样就可以通过 require `1.0.x-dev` 来得到 `dev-master` 版本的包。 它表示一个包版本的别名。例如,你可以为 `dev-master` 设置别名 `1.0.x-dev`,这样就可以通过 require `1.0.x-dev` 来得到 `dev-master` 版本的包。
详细请查看[“别名”](../articles/aliases.md)。 详细请查看[“别名”](articles/aliases.md)。
<a name="Lock-file"></a> <a name="Lock-file"></a>
## 锁文件 ## 锁文件

View File

@ -434,7 +434,7 @@ php composer.phar create-project doctrine/orm path 2.2.*
<a name="run-script"></a> <a name="run-script"></a>
## 执行脚本 `run-script` ## 执行脚本 `run-script`
你可以运行此命令来手动执行 [脚本](../articles/scripts.md),只需要指定脚本的名称,可选的 `--no-dev` 参数允许你禁用开发者模式。 你可以运行此命令来手动执行 [脚本](articles/scripts.md),只需要指定脚本的名称,可选的 `--no-dev` 参数允许你禁用开发者模式。
<a name="diagnose"></a> <a name="diagnose"></a>
## 诊断 `diagnose` ## 诊断 `diagnose`
@ -498,7 +498,7 @@ COMPOSER=composer-other.json php composer.phar install
<a name="COMPOSER_BIN_DIR"></a> <a name="COMPOSER_BIN_DIR"></a>
### COMPOSER_BIN_DIR ### COMPOSER_BIN_DIR
通过设置这个环境变量,你可以指定 `bin`[Vendor Binaries](../articles/vendor-binaries.md))目录到 `vendor/bin` 以外的其它目录。 通过设置这个环境变量,你可以指定 `bin`[Vendor Binaries](articles/vendor-binaries.md))目录到 `vendor/bin` 以外的其它目录。
<a name="http_proxy-or-HTTP_PROXY"></a> <a name="http_proxy-or-HTTP_PROXY"></a>
### http_proxy or HTTP_PROXY ### http_proxy or HTTP_PROXY

View File

@ -120,7 +120,7 @@ composer 原生支持以下4种类型
- **library:** 这是默认类型,它会简单的将文件复制到 `vendor` 目录。 - **library:** 这是默认类型,它会简单的将文件复制到 `vendor` 目录。
- **project:** 这表示当前包是一个项目,而不是一个库。例:框架应用程序 [Symfony standard edition](https://github.com/symfony/symfony-standard),内容管理系统 [SilverStripe installer](https://github.com/silverstripe/silverstripe-installer) 或者完全成熟的分布式应用程序。使用 IDE 创建一个新的工作区时,这可以为其提供项目列表的初始化。 - **project:** 这表示当前包是一个项目,而不是一个库。例:框架应用程序 [Symfony standard edition](https://github.com/symfony/symfony-standard),内容管理系统 [SilverStripe installer](https://github.com/silverstripe/silverstripe-installer) 或者完全成熟的分布式应用程序。使用 IDE 创建一个新的工作区时,这可以为其提供项目列表的初始化。
- **metapackage:** 当一个空的包,包含依赖并且需要触发依赖的安装,这将不会对系统写入额外的文件。因此这种安装类型并不需要一个 dist 或 source。 - **metapackage:** 当一个空的包,包含依赖并且需要触发依赖的安装,这将不会对系统写入额外的文件。因此这种安装类型并不需要一个 dist 或 source。
- **composer-plugin:** 一个安装类型为 `composer-plugin` 的包,它有一个自定义安装类型,可以为其它包提供一个 installler。详细请查看 [自定义安装类型](../articles/custom-installers.md)。 - **composer-plugin:** 一个安装类型为 `composer-plugin` 的包,它有一个自定义安装类型,可以为其它包提供一个 installler。详细请查看 [自定义安装类型](articles/custom-installers.md)。
仅在你需要一个自定义的安装逻辑时才使用它。建议忽略这个属性,采用默认的 `library` 仅在你需要一个自定义的安装逻辑时才使用它。建议忽略这个属性,采用默认的 `library`
@ -334,7 +334,7 @@ composer 原生支持以下4种类型
> 正因为如此,在某些情况下,它不会是一个实用的解决方法, > 正因为如此,在某些情况下,它不会是一个实用的解决方法,
> 如果可能,你应该总是尝试切换到拥有标签的版本。 > 如果可能,你应该总是尝试切换到拥有标签的版本。
它也可以应用于行内别名,这样它将匹配一个约束,否则不会。更多信息请参考 [别名](../articles/aliases.md)。 它也可以应用于行内别名,这样它将匹配一个约束,否则不会。更多信息请参考 [别名](articles/aliases.md)。
<a name="require"></a> <a name="require"></a>
#### require #### require
@ -694,7 +694,7 @@ Repositories 并不是递归调用的只能在“Root包”的 `composer.json
* **github-oauth:** 一个域名和 oauth keys 的列表。 * **github-oauth:** 一个域名和 oauth keys 的列表。
例如:使用 `{"github.com": "oauthtoken"}` 作为此选项的值, 例如:使用 `{"github.com": "oauthtoken"}` 作为此选项的值,
将使用 `oauthtoken` 来访问 github 上的私人仓库,并绕过 low IP-based rate 的 API 限制。 将使用 `oauthtoken` 来访问 github 上的私人仓库,并绕过 low IP-based rate 的 API 限制。
[关联知识](../articles/troubleshooting.md#api-rate-limit-and-oauth-tokens) [关联知识](articles/troubleshooting.md#api-rate-limit-and-oauth-tokens)
关于如何获取 GitHub 的 OAuth token。 关于如何获取 GitHub 的 OAuth token。
* **vendor-dir:** 默认为 `vendor`。通过设置你可以安装依赖到不同的目录。 * **vendor-dir:** 默认为 `vendor`。通过设置你可以安装依赖到不同的目录。
* **bin-dir:** 默认为 `vendor/bin`。如果一个项目包含二进制文件,它们将被连接到这个目录。 * **bin-dir:** 默认为 `vendor/bin`。如果一个项目包含二进制文件,它们将被连接到这个目录。
@ -727,7 +727,7 @@ Repositories 并不是递归调用的只能在“Root包”的 `composer.json
Composer 允许你在安装过程中的各个阶段挂接脚本。 Composer 允许你在安装过程中的各个阶段挂接脚本。
更多细节和案例请查看 [脚本](../articles/scripts.md)。 更多细节和案例请查看 [脚本](articles/scripts.md)。
<a name="extra"></a> <a name="extra"></a>
### extra ### extra
@ -747,7 +747,7 @@ $extra = $event->getComposer()->getPackage()->getExtra();
该属性用于标注一组应被视为二进制脚本的文件他们会被软链接到config 对象中的)`bin-dir` 属性所标注的目录,以供其他依赖包调用。 该属性用于标注一组应被视为二进制脚本的文件他们会被软链接到config 对象中的)`bin-dir` 属性所标注的目录,以供其他依赖包调用。
详细请查看 [Vendor Binaries](../articles/vendor-binaries.md)。 详细请查看 [Vendor Binaries](articles/vendor-binaries.md)。
可选。 可选。

View File

@ -59,7 +59,7 @@ Composer 是一个依赖管理工具。它在本地安装一些资源包。一
默认情况下已经将 Packagist.org 注册到 Composer。你可以在 `composer.json` 中申明更多的资源库,把它们加入你的项目中。 默认情况下已经将 Packagist.org 注册到 Composer。你可以在 `composer.json` 中申明更多的资源库,把它们加入你的项目中。
资源库的定义仅可用于“root 包”,而在你依赖的包中定义的资源库将不会被加载。如果你想了解其中的原因,请阅读 [FAQ entry](../faq/why-can't-composer-load-repositories-recursively.md)。 资源库的定义仅可用于“root 包”,而在你依赖的包中定义的资源库将不会被加载。如果你想了解其中的原因,请阅读 [FAQ entry](faq/why-can't-composer-load-repositories-recursively.md)。
<a name="Types"></a> <a name="Types"></a>
## Types ## Types
@ -241,7 +241,7 @@ VCS 表示版本控制系统。这包括像 git、svn 或 hg 这样的版本管
注意,你不应该对包进行重命名,除非你真的打算摆脱原来的包,并长期的使用你自己的 fork。这样 Composer 就会正确获取你的包了。如果你确定要重命名这个包,你应该在默认分支(通常是 master 分支)上操作,而不是特性分支,因为包的名字取自默认分支。 注意,你不应该对包进行重命名,除非你真的打算摆脱原来的包,并长期的使用你自己的 fork。这样 Composer 就会正确获取你的包了。如果你确定要重命名这个包,你应该在默认分支(通常是 master 分支)上操作,而不是特性分支,因为包的名字取自默认分支。
如果其它包依赖你 fork 的这个分支,可能要对它做版本号的行内别名设置,才能够准确的识别版本约束。更多相关信息请查看 [别名](../articles/aliases.md)。 如果其它包依赖你 fork 的这个分支,可能要对它做版本号的行内别名设置,才能够准确的识别版本约束。更多相关信息请查看 [别名](articles/aliases.md)。
<a name="Using-private"></a> <a name="Using-private"></a>
#### 使用私有资源库 #### 使用私有资源库
@ -456,7 +456,7 @@ Satis 是一个静态的 `composer` 资源库生成器。它像是一个超轻
你给它一个包含 `composer.json` 的存储库,定义好 VCS 和 资源库。它会获取所有你列出的包,并打印 `packages.json` 文件,作为 `composer` 类型的资源库。 你给它一个包含 `composer.json` 的存储库,定义好 VCS 和 资源库。它会获取所有你列出的包,并打印 `packages.json` 文件,作为 `composer` 类型的资源库。
更多详细信息请查看 [github.com/composer/satis](https://github.com/composer/satis) 和 [Satis article](../articles/handling-private-packages-with-satis.md)。 更多详细信息请查看 [github.com/composer/satis](https://github.com/composer/satis) 和 [Satis article](articles/handling-private-packages-with-satis.md)。
<a name="Artifact"></a> <a name="Artifact"></a>
### Artifact ### Artifact

View File

@ -13,13 +13,13 @@ Composer 中文文档
--- ---
## Book ## Book
- [简介](/cn-introduction/00-intro.md) - [简介](/00-intro.md)
- [基本用法](/cn-introduction/01-basic-usage.md) - [基本用法](/01-basic-usage.md)
- [库(资源包)](/cn-introduction/02-libraries.md) - [库(资源包)](/02-libraries.md)
- [命令行](/cn-introduction/03-cli.md) - [命令行](/03-cli.md)
- [架构](/cn-introduction/04-schema.md) - [架构](/04-schema.md)
- [资源库](/cn-introduction/05-repositories.md) - [资源库](/05-repositories.md)
- [社区](/cn-introduction/06-community.md) - [社区](/06-community.md)
## Articles ## Articles
- [别名](/articles/aliases.md) - [别名](/articles/aliases.md)

View File

@ -158,8 +158,8 @@ class TemplateInstaller extends LibraryInstaller
> _并非安装在 `/vendor` 目录,任何使用这个安装程序的资源包,将被放置在 `/data/templates/<stripped name>` 目录中。_ > _并非安装在 `/vendor` 目录,任何使用这个安装程序的资源包,将被放置在 `/data/templates/<stripped name>` 目录中。_
[1]: ../cn-introduction/04-schema.md#type [1]: ../04-schema.md#type
[2]: ../cn-introduction/04-schema.md#extra [2]: ../04-schema.md#extra
[3]: https://github.com/composer/composer/blob/master/src/Composer/Plugin/PluginInterface.php [3]: https://github.com/composer/composer/blob/master/src/Composer/Plugin/PluginInterface.php
[4]: https://github.com/composer/composer/blob/master/src/Composer/Installer/InstallerInterface.php [4]: https://github.com/composer/composer/blob/master/src/Composer/Installer/InstallerInterface.php
[5]: https://github.com/composer/composer/blob/master/src/Composer/Installer/LibraryInstaller.php [5]: https://github.com/composer/composer/blob/master/src/Composer/Installer/LibraryInstaller.php

View File

@ -18,10 +18,10 @@ Satis 是一个静态的 `composer` 代码库生成器。
For example let's assume you have a few packages you want to reuse across your For example let's assume you have a few packages you want to reuse across your
company but don't really want to open-source. You would first define a Satis company but don't really want to open-source. You would first define a Satis
configuration: a json file with an arbitrary name that lists your curated configuration: a json file with an arbitrary name that lists your curated
[repositories](../cn-introduction/05-repositories.md). [repositories](../05-repositories.md).
Here is an example configuration, you see that it holds a few VCS repositories, Here is an example configuration, you see that it holds a few VCS repositories,
but those could be any types of [repositories](../cn-introduction/05-repositories.md). Then it but those could be any types of [repositories](../05-repositories.md). Then it
uses `"require-all": true` which selects all versions of all packages in the uses `"require-all": true` which selects all versions of all packages in the
repositories you defined. repositories you defined.

View File

@ -124,8 +124,8 @@ class AwsPlugin implements PluginInterface, EventSubscriberInterface
> 你可以通过 `--no-plugins` 选项让 composer 的命令禁用所有已经安装的插件。这或许是特别有用的,如果任何插件会导致错误,而你想要升级或卸载它。 > 你可以通过 `--no-plugins` 选项让 composer 的命令禁用所有已经安装的插件。这或许是特别有用的,如果任何插件会导致错误,而你想要升级或卸载它。
[1]: ../cn-introduction/04-schema.md#type [1]: ../04-schema.md#type
[2]: ../cn-introduction/04-schema.md#extra [2]: ../04-schema.md#extra
[3]: https://github.com/composer/composer/blob/master/src/Composer/Plugin/PluginInterface.php [3]: https://github.com/composer/composer/blob/master/src/Composer/Plugin/PluginInterface.php
[4]: https://github.com/composer/composer/blob/master/src/Composer/Composer.php [4]: https://github.com/composer/composer/blob/master/src/Composer/Composer.php
[5]: https://github.com/composer/composer/blob/master/src/Composer/IO/IOInterface.php [5]: https://github.com/composer/composer/blob/master/src/Composer/IO/IOInterface.php

View File

@ -7,11 +7,11 @@ This is a list of common pitfalls on using Composer, and how to avoid them.
## General ## General
1. Before asking anyone, run [`composer diagnose`](../cn-introduction/03-cli.md#diagnose) to check 1. Before asking anyone, run [`composer diagnose`](../03-cli.md#diagnose) to check
for common problems. If it all checks out, proceed to the next steps. for common problems. If it all checks out, proceed to the next steps.
2. When facing any kind of problems using Composer, be sure to **work with the 2. When facing any kind of problems using Composer, be sure to **work with the
latest version**. See [self-update](../cn-introduction/03-cli.md#self-update) for details. latest version**. See [self-update](../03-cli.md#self-update) for details.
3. Make sure you have no problems with your setup by running the installer's 3. Make sure you have no problems with your setup by running the installer's
checks via `curl -sS https://getcomposer.org/installer | php -- --check`. checks via `curl -sS https://getcomposer.org/installer | php -- --check`.
@ -27,7 +27,7 @@ This is a list of common pitfalls on using Composer, and how to avoid them.
branches and tag names. branches and tag names.
2. Be sure to **set the right 2. Be sure to **set the right
[minimum-stability](../cn-introduction/04-schema.md#minimum-stability)**. To get started or be [minimum-stability](../04-schema.md#minimum-stability)**. To get started or be
sure this is no issue, set `minimum-stability` to "dev". sure this is no issue, set `minimum-stability` to "dev".
3. Packages **not coming from [Packagist](https://packagist.org/)** should 3. Packages **not coming from [Packagist](https://packagist.org/)** should

View File

@ -13,6 +13,6 @@
如果你真的觉得你必须这样做,你有几个选择: 如果你真的觉得你必须这样做,你有几个选择:
1. 限制自己安装标记版本(无 dev 版本),这样你只会得到 zip 压缩的安装,并避免 git“子模块”出现的问题。 1. 限制自己安装标记版本(无 dev 版本),这样你只会得到 zip 压缩的安装,并避免 git“子模块”出现的问题。
2. 使用 --prefer-dist 或在 [config](../cn-introduction/04-schema.md#config) 选项中设置 `preferred-install``dist` 2. 使用 --prefer-dist 或在 [config](../04-schema.md#config) 选项中设置 `preferred-install``dist`
3. 在每一个依赖安装后删除其下的 `.git` 文件夹,然后你就可以添加它们到你的 git repo 中。你可以运行 `rm -rf vendor/**/.git` 命令快捷的操作,但这意味着你在运行 composer update 命令前需要先删除磁盘中的依赖文件。 3. 在每一个依赖安装后删除其下的 `.git` 文件夹,然后你就可以添加它们到你的 git repo 中。你可以运行 `rm -rf vendor/**/.git` 命令快捷的操作,但这意味着你在运行 composer update 命令前需要先删除磁盘中的依赖文件。
4. 新增一个 .gitignore 规则(`vendor/.git`)来忽略 vendor 下所有 `.git` 目录。这种方法不需要你在运行 composer update 命令前删除你磁盘中的依赖文件。 4. 新增一个 .gitignore 规则(`vendor/.git`)来忽略 vendor 下所有 `.git` 目录。这种方法不需要你在运行 composer update 命令前删除你磁盘中的依赖文件。