Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-9479

composer require couchbase/couchbase installs wrong version of PHP driver classes

    XMLWordPrintable

Details

    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

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            richard.smedley Richard Smedley
            docsite-collector Docs Site Collector
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty