cakephp websocket棘轮安装错误

时间:2014-04-04 12:07:11

标签: cakephp ratchet

我正在尝试在现有项目中安装Cakephp Ratchet Plugin。 我的CakePHP版本是2.4.3。 它表示要关注this link,其中包含以下步骤:

 $ cd myproject/app/
 $ curl -s https://getcomposer.org/installer | php
 $ php composer.phar require --no-update opauth/opauth:dev-wip/1.0 opauth/twitter:dev-     wip/1.0
 $ php composer.phar config vendor-dir Vendor
 $ php composer.phar install

我对作曲家不熟悉,当我做最后一步时,它会显示以下错误......

Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package opauth/opauth could not be found in any version, there may be a typo in the package name.
Problem 2
- The requested package opauth/twitter could not be found in any version, there may be a typo in the package name.

Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting

编辑: Composer.json就是这样的

    {
"require": {
"opauth/opauth": "dev-wip/1.0",
    "opauth/twitter": "dev-wip/1.0"
},
"config": {
    "vendor-dir": "Vendor"
}
  }

1 个答案:

答案 0 :(得分:1)

正如我在评论中已经提到的,Ratchet插件与Opauth无关,ceeram.github.io上的链接文章应仅作为如何配置Composer和CakePHP引导程序的示例。

但是,对于CakePHP中的Composer自动加载,我建议参考CakePHP食谱,即使你没有通过Composer包含CakePHP本身:

<强> http://book.cakephp.org/2.0/en/installation/advanced-installation.html

长话短说,插件文档的“ 入门/ 2.编写器 ”部分要求你做的是,需要使用棘轮插件,制作确保供应商目录指向/app/Vendor/,并在您的bootstrap.php中加入Composer自动加载器。

composer.json (假设它放在/app

{
    "require": {
        "wyrihaximus/ratchet": "dev-master"
    },
    "config": {
        "vendor-dir": "Vendor"
    }
}

bootstrap.php (根据Cookbook)

// Load Composer autoload.
require APP . '/Vendor/autoload.php';

// Remove and re-prepend CakePHP's autoloader as Composer thinks it is the
// most important.
// See: http://goo.gl/kKVJO7
spl_autoload_unregister(array('App', 'load'));
spl_autoload_register(array('App', 'load'), true, true);

运行composer installcomposer update,你应该做得很好。