Details
-
Bug
-
Resolution: Won't Fix
-
None
-
None
-
None
-
*Location*: https://docs.couchbase.com/php-sdk/current/hello-world/start-using-sdk.html
*Referrer*: https://docs.couchbase.com/home/sdk.html
*User-Agent*: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
*Screen Resolution*: 5120 x 1440*Location*: https://docs.couchbase.com/php-sdk/current/hello-world/start-using-sdk.html *Referrer*: https://docs.couchbase.com/home/sdk.html *User-Agent*: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36 *Screen Resolution*: 5120 x 1440
Description
Following the Hello Couchbase example (after successfully installing the PHP 3.2 driver and importing the PHP stubs via `composer require couchbase/couchbase` as detailed in the 'post-install steps' section):
```
$connectionString = "couchbase://localhost";
$options = new \Couchbase\ClusterOptions();
$options->credentials("user", "pass");
$cluster = new \Couchbase\Cluster($connectionString, $options);
$bucket = $cluster->bucket("dev");
// get a default collection reference
$collection = $bucket->defaultCollection();
$res = $collection->get("mydocumentid");
$doc = $res->content();
```
Reveals that my IDE (PHPStorm) cannot resolve the core CB types, because they're missing from the Composer package:
`Undefined class 'Cluster'`
`Undefined class 'ClusterOptions'`
The reason for this is that the Composer library appears to install the stubs for the rather ancient 2.3 version of the driver, NOT the current version, despite referencing the current version `"couchbase/couchbase": "^3.1"`
In order for the Composer library to be at all useful, the core PHP classes from the CURRENT SDK (including most importantly, `Cluster` and `ClusterOptions` must be present (or at the very least, stubs for each of the core classes)).
Please update your Composer package to support the current version of the PHP driver.
Reporter: Robert Mirabelle
E-mail: robert.mirabelle@metropcr.com