update 04-schema.md

This commit is contained in:
成武 2014-01-06 18:34:55 +08:00
parent ecfa7eaa52
commit e028a89500
1 changed files with 10 additions and 17 deletions

View File

@ -384,35 +384,28 @@ PSR-0 方式并不仅限于申明命名空间,也可以是精确到类级别
### include-path ### include-path
> **DEPRECATED**: This is only present to support legacy projects, and all new code > **不建议**:这是目前唯一支持传统项目的做法,所有新的代码都建议使用自动加载。
> should preferably use autoloading. As such it is a deprecated practice, but the > 这是一个过时的做法,但 Composer 将仍然保留这个功能。
> feature itself will not likely disappear from Composer.
A list of paths which should get appended to PHP's `include_path`. 一个追加到 PHP `include_path` 中的列表。
Example: 例如:
{ {
"include-path": ["lib/"] "include-path": ["lib/"]
} }
Optional. 可选。
### target-dir ### target-dir
Defines the installation target. 定义当前包安装的目标文件夹。
In case the package root is below the namespace declaration you cannot 若某个包的根目录,在它申明的命名空间之下,将不能正确的使用自动加载。而 `target-dir` 解决了这个问题。
autoload properly. `target-dir` solves this problem.
An example is Symfony. There are individual packages for the components. The Symfony 就是一个例子。它有一些独立的包作为组件。Yaml 组件就放在 `Symfony\Component\Yaml` 目录下,然而这个包的根目录实际上是 `Yaml`。为了使自动加载成为可能,我们需要确保它不会被安装到 `vendor/symfony/yaml`,而是安装到 `vendor/symfony/yaml/Symfony/Component/Yaml`,从而使 Symfony 定义的 autoloader 可以从 `vendor/symfony/yaml` 加载它。
Yaml component is under `Symfony\Component\Yaml`. The package root is that
`Yaml` directory. To make autoloading possible, we need to make sure that it
is not installed into `vendor/symfony/yaml`, but instead into
`vendor/symfony/yaml/Symfony/Component/Yaml`, so that the autoloader can load
it from `vendor/symfony/yaml`.
To do that, `autoload` and `target-dir` are defined as follows: 要做到这一点 `autoload``target-dir` 应该定义如下:
{ {
"autoload": { "autoload": {
@ -421,7 +414,7 @@ To do that, `autoload` and `target-dir` are defined as follows:
"target-dir": "Symfony/Component/Yaml" "target-dir": "Symfony/Component/Yaml"
} }
Optional. 可选。
### minimum-stability <span>(root-only)</span> ### minimum-stability <span>(root-only)</span>