Question

I am trying to install Cakephp Ratchet Plugin in existing project. My CakePHP version is 2.4.3. It says to follow this link which has following steps:

 $ 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

I am not very familiar with composer and when i do the last step,it shows following error....

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

EDIT: Composer.json is like this

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

Solution

As already mentioned in my comment, the Ratchet Plugin has nothing to do with Opauth, the linked article over at ceeram.github.io should only serve as an example on how to configure Composer and the CakePHP bootstrap.

However, for Composer autoloading in CakePHP I'd recommend to refer to the CakePHP cookbook, even if you're not including CakePHP itself via Composer:

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

Long story short, what the "Getting Started / 2. Composer" section of the plugin docs want you to do, is to require the ratchet plugin, to make sure the vendor dir points to /app/Vendor/, and to include the Composer autoloader in your bootstrap.php.

composer.json (assuming it's placed in /app)

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

bootstrap.php (as per 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);

Run composer install or composer update and you should be good.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top