【问题标题】:How to install ZendRest module in zf2?如何在 zf2 中安装 ZendRest 模块?
【发布时间】:2012-08-17 22:37:48
【问题描述】:

我想安装ZF2 ZendRest module

如何安装?

当我在做的时候

php .\composer.phar install

在\vendor\zendrest 中。我明白了:

Loading composer repositories with package information 
Installing dependencies 
Your requirements could not be resolved to an installable set of packages.

  Problem 1
- The requested package zendframework/zend-http 1.0.0 could not be found.
  Problem 2
- The requested package zendframework/zend-uri 1.0.0 could not be found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-    stability setting
   see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.

我应该把 ZendRest 文件夹放在哪里?

谢谢!

【问题讨论】:

  • 您可以发布您的composer.json 文件吗?
  • 我使用了这里给出的 composer.json:github.com/zendframework/ZendRest/blob/master/composer.json
  • 作曲家不是这样工作的!您需要创建自己的composer.json 并将依赖项添加到zendframework/zendrest
  • 是的,但是我在里面放了什么?我应该把它放在哪里?我的主干文件夹中已经有了 Zend Framework 的 composer.json。

标签: zend-framework zend-framework2 composer-php


【解决方案1】:

ZendRest 依赖项没有稳定版本:zend-http 和 zend-uri(有关现有版本,请参阅下面的 show 输出)。 Composer默认情况下依赖于稳定的包。这就是您无法安装此软件包的原因。

$ composer show zendframework/zend-http
name     : zendframework/zend-http
descrip. : provides an easy interface for preforming Hyper-Text Transfer Protocol (HTTP) requests
keywords : zf2, http
versions : 2.0.0rc4, 2.0.0rc3, 2.0.0rc2, 2.0.0-rc1, 2.0.0-beta5, 2.0.0-beta4
type     : library
...

您应该在项目中将minimum-stability 更改为dev

{
    "require": {
        // ...
    },
    "minimum-stability": "dev"
}

编辑: 例如,以下composer.json 有效。这是您在自己的项目中应该拥有的(可能有更多依赖项):

{
    "require": {
        "zendframework/zend-rest": "*" 
    },  
    "repositories": [
        {   
            "type": "composer",
            "url": "http://packages.zendframework.com/"
        }   
    ],  
    "minimum-stability": "dev"
}

【讨论】:

  • 很好的答案,但有一个错字。它应该是composer.json 中的"zendframework/zendrest",不带连字符。
猜你喜欢
  • 1970-01-01
  • 2013-09-29
  • 2012-11-11
  • 2012-08-01
  • 2011-02-10
  • 2011-02-23
  • 2020-10-26
  • 2016-03-24
  • 2021-05-22
相关资源
最近更新 更多