如何在zf2中安装ZendRest模块?

时间:2012-08-22 13:27:29

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

我想安装ZF2 ZendRest module

如何安装?

我在做什么时

php .\composer.phar install

in \ 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文件夹放在哪里?

谢谢!

1 个答案:

答案 0 :(得分:2)

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"
}