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