0

我正在尝试 在现有项目中安装Cakephp Ratchet 插件。我的 CakePHP 版本是 2.4.3。它说要遵循此链接,该链接 具有以下步骤:

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

1 回答 1

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. Composer ”部分希望您做的是需要棘轮插件,确保供应商目录指向/app/Vendor/,并将 Composer 自动加载器包含在您的bootstrap.php.

composer.json(假设它被放置在/app

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

bootstrap.php(根据食谱)

// 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你应该很好。

于 2014-04-05T10:23:20.787 回答