2012-08-22 60 views
1

我想安装ZF2 ZendRest module如何在zf2中安装ZendRest模块?

如何安装?

当我在\供应商\ zendrest做

php .\composer.phar install 

。我得到:

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文件夹?

谢谢!

+0

你可以发布你的'composer.json'文件吗? – Florent

+0

我使用了这里给出的composer.json:https://github.com/zendframework/ZendRest/blob/master/composer.json – Dionysos

+0

这不是作曲家的作品!你需要创建你自己的'composer.json'并添加一个依赖到'zendframework/zendrest'。 – Florent

回答

2

ZendRest依赖关系没有稳定的版本:zend-http和zend-uri(请参阅下面show输出的现有版本)。 作曲家依靠稳定包默认。这就是为什么你不能安装这个软件包。

$ 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-stabilitydev在您的项目:

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

编辑:以下composer.json作品实例。这是你应该在你自己的项目中(可能有更多的依赖项):

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

很好的答案,但有一个错字。它应该是''zendframework/zendrest“'在'composer.json'中,没有连字符。 – Patito