Managing Connections using the PHP SDK with Couchbase Server
This section describes how to connect the PHP SDK to a Couchbase cluster. It contains best practices as well as information on TLS/SSL and other advanced connection options.
A connection to a Couchbase Server cluster is represented by a
cluster provides access to Buckets, Scopes, and Collections, as well as various Couchbase services and management interfaces.
The simplest way to create a
Cluster object is to call a new
connectionString with a username and password:
connectionString = "couchbase://localhost"; options = new \Couchbase\ClusterOptions(); options->credentials("Administrator", "password"); cluster = new \Couchbase\Cluster(connectionString, options);
If you are connecting to a version of Couchbase Server older than 6.5, it will be more efficient if the addresses are those of data (KV) nodes.
You will in any case, with 6.0 and earlier, need to open a
Connection strings and the
__construct() method are covered in the API guide.