2014-04-04 44 views
0

我試圖在現有項目中安裝Cakephp Ratchet Plugin。 我的CakePHP版本是2.4.3。 它說按照this link已下列步驟:cakephp websocket棘輪安裝錯誤

$ 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" 
} 
    } 
+0

據我瞭解,文檔只是指作曲家和引導配置,而不是這些opauth包!你的項目是否有'composer.json'文件?如果是這樣,它看起來是什麼樣子,放在哪裏? ps,請始終提及您的確切CakePHP版本! – ndm

+0

我編輯並添加了composer.json文件。 – Nemesis

回答

1

正如我的評論已經提到,棘輪插件已經無關Opauth,關於ceeram.github.io的鏈接文章應僅作爲如何配置Composer和CakePHP引導程序的示例。

然而,在CakePHP的作曲家自動加載,我建議指CakePHP的食譜,即使你不通過作曲,包括CakePHP的本身:

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

長話短說,什麼在「入門/ 2作曲」文檔要你做插件的部分,是要求棘輪插件,以確保供應商目錄指向/app/Vendor/,並在您作曲家自動加載磁帶機。

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,你應該是不錯的。

+0

我能夠做到這一點...你能解釋我的下一步呢...設置棘輪和asssetcompress ...謝謝你.. – Nemesis

+0

我添加了「CakePlugin :: load('Ratchet',array('bootstrap' => true));「在bootstrap.php中,並執行「> cd {Your Cake Project}/app/Console/ > chmod + x cake > ./cake Ratchet.websocket start」 但它顯示: 您的配置似乎不支持' EXT-的libevent」。我們高度推薦您安裝和配置它,因爲它在流選擇上提供顯着的性能提升! – Nemesis

+0

@Nemesis AFAICT這是一個警告,而不是一個錯誤。 [**'ext-libevent' **](http://www.php.net/manual/en/book.libevent.php)是[**'reactphp/event-loop ** ** ](https://github.com/reactphp/event-loop/blob/v0.4.0/composer.json)。然而,我不熟悉ratchet或reactphp,所以除了讓你熟悉這些庫的工作方式以外,我不能給出任何可靠的建議。 – ndm