沃梦达 / 编程问答 / php问题 / 正文

Zend Framework Composer 包

Zend Framework Composer Packages(Zend Framework Composer 包)

本文介绍了Zend Framework Composer 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想给 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

这篇关于Zend Framework Composer 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Zend Framework Composer 包

基础教程推荐