Zend Framework Composer 包

2022-01-21 00:00:00 package php composer-php zend-framework

我想给 zendframework/zend-db 包添加依赖,所以我把它添加到了我的 composer.json:

I would like to add dependency to zendframework/zend-db package, so I added it to my composer.json:

"repositories": [
    {
        "type": "composer",
        "url": "http://packages.zendframework.com/"
    }
],
"require": {
    "php": ">=5.3.2",

    "symfony/class-loader":  "dev-master",
    "symfony/console":       "dev-master",
    "symfony/filesystem":    "dev-master",
    "symfony/finder":        "dev-master",
    "symfony/locale":        "dev-master",
    "symfony/yaml":          "dev-master",
    "doctrine/dbal":         "dev-master",
    "zendframework/zend-db": "dev-master"
}

问题是 composer 安装了整个 zendframework/zendframework 包.

The problem is that composer installs entire zendframework/zendframework package.

知道为什么吗?

推荐答案

这里是 composer.json 来自 zend github 中的 zend-db.根据文件,zend-db没有任何依赖关系.

Here's the composer.json from zend-db in the zend github. According to the file, zend-db does not have any dependencies.

这可能是因为您尝试从 dev-master 下载包,而 dev-master 的 composer.json 中存在不匹配.

This can be due to the fact that you're trying to download a package from dev-master and there's a missmatch in the composer.json of the dev-master.

建议您将所需版本更改为 2.0.* 之类的版本,然后重试.

此外,尽管 Zend 框架是松耦合的,但在旧版本的框架中,依赖关系并不明确.

Also, Although Zend Framework is loosely coupled, in the older versions of the framework the dependencies were not explicit.

例如,通过快速浏览 ZEND 1.9 中的 zend_db 源代码,我发现它至少依赖于以下软件包:

For instance, with a quick sweep over the source code of zend_db from ZEND 1.9, I found that it depends, at least, on the following packages:

  • 控制器
  • 配置
  • 过滤器
  • json
  • 加载器(对于自动加载,我认为由于 composer 自动加载器,这可能不是必需的)
  • 乌里
  • 查看
  • 野火

这些包可能有其他依赖关系,因此下载大小.无论如何,正如 King 解释的那样,Zend Framework 2.0 与 1.9 版本不同,也许这不适用于 2.0

These packages might have other dependencies, hence the download size. Regardless, as King explained, Zend Framework 2.0 is different from version 1.9 and maybe this is not applicable to 2.0

相关文章