update cn-introduction/03-cli.md
This commit is contained in:
parent
77a54e40b0
commit
14f4edf8af
|
@ -59,80 +59,64 @@
|
||||||
|
|
||||||
* **--prefer-source:** 下载包的方式有两种: `source`
|
* **--prefer-source:** 下载包的方式有两种: `source`
|
||||||
和 `dist`。对于稳定版本 composer 将默认使用 `dist` 方式。而 `source` 表示版本控制源 。如果 `--prefer-source` 是被启用的,composer 将从 `source` 安装(如果有的话)。如果想要使用一个 bugfix 到你的项目,这是非常有用的。并且可以直接从本地的版本库直接获取依赖关系。
|
和 `dist`。对于稳定版本 composer 将默认使用 `dist` 方式。而 `source` 表示版本控制源 。如果 `--prefer-source` 是被启用的,composer 将从 `source` 安装(如果有的话)。如果想要使用一个 bugfix 到你的项目,这是非常有用的。并且可以直接从本地的版本库直接获取依赖关系。
|
||||||
* **--prefer-dist:** 与 `--prefer-source` 相反,composer 将尽可能的从 `dist` 获取,这将大幅度的加快在 build servers 上的安装。这也是一个回避 git 问题的途径,如果你清楚任何正确的设置。
|
* **--prefer-dist:** 与 `--prefer-source` 相反,composer 将尽可能的从 `dist` 获取,这将大幅度的加快在 build servers 上的安装。这也是一个回避 git 问题的途径,如果你不清楚如何正确的设置。
|
||||||
* **--dry-run:** If you want to run through an installation without actually
|
* **--dry-run:** 如果你只是想演示而并非实际安装一个包,你可以运行 `--dry-run` 命令,它将模拟安装并显示将会发生什么。
|
||||||
installing a package, you can use `--dry-run`. This will simulate the
|
* **--dev:** 安装 `require-dev` 字段中列出的包(这是一个默认值)。
|
||||||
installation and show you what would happen.
|
* **--no-dev:** 跳过 `require-dev` 字段中列出的包。
|
||||||
* **--dev:** Install packages listed in `require-dev` (this is the default behavior).
|
* **--no-scripts:** 跳过 `composer.json` 文件中定义的脚本。
|
||||||
* **--no-dev:** Skip installing packages listed in `require-dev`.
|
* **--no-plugins:** 关闭 plugins。
|
||||||
* **--no-scripts:** Skips execution of scripts defined in `composer.json`.
|
* **--no-progress:** 移除进度信息,这可以避免一些不处理换行的终端或脚本出现混乱的显示。
|
||||||
* **--no-plugins:** Disables plugins.
|
* **--optimize-autoloader (-o):** 转换 PSR-0 autoloading 到 classmap 可以获得更快的加载支持。特别是在生产环境下建议这么做,但由于运行需要一些时间,因此并没有作为默认值。
|
||||||
* **--no-progress:** Removes the progress display that can mess with some
|
|
||||||
terminals or scripts which don't handle backspace characters.
|
|
||||||
* **--optimize-autoloader (-o):** Convert PSR-0 autoloading to classmap to get a faster
|
|
||||||
autoloader. This is recommended especially for production, but can take
|
|
||||||
a bit of time to run so it is currently not done by default.
|
|
||||||
|
|
||||||
## 更新 `update`
|
## 更新 `update`
|
||||||
|
|
||||||
In order to get the latest versions of the dependencies and to update the
|
为了获取依赖的最新版本,并且升级 `composer.lock` 文件,你应该使用 `update` 命令。
|
||||||
`composer.lock` file, you should use the `update` command.
|
|
||||||
|
|
||||||
$ php composer.phar update
|
$ php composer.phar update
|
||||||
|
|
||||||
This will resolve all dependencies of the project and write the exact versions
|
这将解决项目的所有依赖,并将确切的版本号写入 `composer.lock`。
|
||||||
into `composer.lock`.
|
|
||||||
|
|
||||||
If you just want to update a few packages and not all, you can list them as such:
|
如果你只是想更新几个包,你可以像这样分别列出它们:
|
||||||
|
|
||||||
$ php composer.phar update vendor/package vendor/package2
|
$ php composer.phar update vendor/package vendor/package2
|
||||||
|
|
||||||
You can also use wildcards to update a bunch of packages at once:
|
你还可以使用通配符进行批量更新:
|
||||||
|
|
||||||
$ php composer.phar update vendor/*
|
$ php composer.phar update vendor/*
|
||||||
|
|
||||||
### 更新选项
|
### 更新选项
|
||||||
|
|
||||||
* **--prefer-source:** Install packages from `source` when available.
|
* **--prefer-source:** 当有可用的包时,从 `source` 安装。
|
||||||
* **--prefer-dist:** Install packages from `dist` when available.
|
* **--prefer-dist:** 当有可用的包时,从 `dist` 安装。
|
||||||
* **--dry-run:** Simulate the command without actually doing anything.
|
* **--dry-run:** 模拟命令,并没有做实际的操作。
|
||||||
* **--dev:** Install packages listed in `require-dev` (this is the default behavior).
|
* **--dev:** 安装 `require-dev` 字段中列出的包(这是一个默认值)。
|
||||||
* **--no-dev:** Skip installing packages listed in `require-dev`.
|
* **--no-dev:** 跳过 `require-dev` 字段中列出的包。
|
||||||
* **--no-scripts:** Skips execution of scripts defined in `composer.json`.
|
* **--no-scripts:** 跳过 `composer.json` 文件中定义的脚本。
|
||||||
* **--no-plugins:** Disables plugins.
|
* **--no-plugins:** 关闭 plugins。
|
||||||
* **--no-progress:** Removes the progress display that can mess with some
|
* **--no-progress:** 移除进度信息,这可以避免一些不处理换行的终端或脚本出现混乱的显示。
|
||||||
terminals or scripts which don't handle backspace characters.
|
* **--optimize-autoloader (-o):** 转换 PSR-0 autoloading 到 classmap 可以获得更快的加载支持。特别是在生产环境下建议这么做,但由于运行需要一些时间,因此并没有作为默认值。
|
||||||
* **--optimize-autoloader (-o):** Convert PSR-0 autoloading to classmap to get a faster
|
* **--lock:** 仅更新 lock 文件的 hash,取消有关 lock 文件过时的警告。
|
||||||
autoloader. This is recommended especially for production, but can take
|
* **--with-dependencies** 同时更新白名单内包的依赖关系,这将进行递归更新。
|
||||||
a bit of time to run so it is currently not done by default.
|
|
||||||
* **--lock:** Only updates the lock file hash to suppress warning about the
|
|
||||||
lock file being out of date.
|
|
||||||
* **--with-dependencies** Add also all dependencies of whitelisted packages to the whitelist.
|
|
||||||
So all packages with their dependencies are updated recursively.
|
|
||||||
|
|
||||||
## 申明依赖 `require`
|
## 申明依赖 `require`
|
||||||
|
|
||||||
The `require` command adds new packages to the `composer.json` file from
|
`require` 命令增加新的依赖包到当前目录的 `composer.json` 文件中。
|
||||||
the current directory.
|
|
||||||
|
|
||||||
$ php composer.phar require
|
$ php composer.phar require
|
||||||
|
|
||||||
After adding/changing the requirements, the modified requirements will be
|
在添加或改变依赖时, 修改后的依赖关系将被安装或者更新。
|
||||||
installed or updated.
|
|
||||||
|
|
||||||
If you do not want to choose requirements interactively, you can just pass them
|
如果你不希望通过交互来指定依赖包,你可以在这条令中直接指明依赖包。
|
||||||
to the command.
|
|
||||||
|
|
||||||
$ php composer.phar require vendor/package:2.* vendor/package2:dev-master
|
$ php composer.phar require vendor/package:2.* vendor/package2:dev-master
|
||||||
|
|
||||||
### 申明依赖的选项
|
### 申明依赖的选项
|
||||||
|
|
||||||
* **--prefer-source:** Install packages from `source` when available.
|
* **--prefer-source:** 当有可用的包时,从 `source` 安装。
|
||||||
* **--prefer-dist:** Install packages from `dist` when available.
|
* **--prefer-dist:** 当有可用的包时,从 `dist` 安装。
|
||||||
* **--dev:** Add packages to `require-dev`.
|
* **--dev:** 安装 `require-dev` 字段中列出的包。
|
||||||
* **--no-update:** Disables the automatic update of the dependencies.
|
* **--no-update:** 禁用依赖关系的自动更新。
|
||||||
* **--no-progress:** Removes the progress display that can mess with some
|
* **--no-progress:** 移除进度信息,这可以避免一些不处理换行的终端或脚本出现混乱的显示。
|
||||||
terminals or scripts which don't handle backspace characters.
|
|
||||||
|
|
||||||
## global
|
## global
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue