Overview

The Couchbase PHP SDK enables you to interact with Couchbase Server from a PHP application.

The PHP SDK consists of a native PHP library and a C/C++ add-on that uses the Couchbase C SDK (libcouchbase) internally. The PHP SDK includes the following components:

  • PHP SDK client
  • Developer guide (you're reading it now!)
  • PHP SDK API reference
  • Sample applications —beer database

Architecture

To debug errors, you must be familiar with the PHP SDK architecture to understand where problems might originate. The following components participate in typical operations:

  • Couchbase Server

    This is the server itself, which stores your data. Errors can happen here if your data does not exist, or if there are connectivity issues with one or more nodes in the server. While Couchbase Server is scalable and fault tolerant, there are naturally some conditions that cause failures (for example, if all nodes are unreachable).

  • libcouchbase

    libcouchbase, our C client library, provides the underlying layer that handles network communication and protocol handling between a client and a Couchbase node. Network connectivity issues tend to happen here.

  • PHP C binding layer

    The binding layer contains the C code that provides the bulk of the SDK. It interfaces with the libcouchbase component, handles marshaling of information between libcouchbase and your application, performs input validation, and encoding and decoding of keys and values.

  • PHP layer

    The PHP layer is written in pure PHP. Simple key-value operations are normally just dispatched to the C layer. Most of the view operations are handled here as well, with the C binding layer just performing the lower-level network handling.

Compatibility

To take advantage of all features offered by Couchbase Server, you need to know what version of the SDK provides compatibility for the features you want to use. The following matrix shows which versions of the PHP SDK support the major features of each version of Couchbase Server.

Table 1. Couchbase Server and SDK Supported Version Matrix
  Server 1.8 Server 2.0 Server 2.5 Server 3.0
Basic Features
CRUD Operations Since 1.0
View Querying APIs Not Supported Since 1.0
Advanced Features
Durability Requirements Since 1.0
Fast (CCCP) Bootstrapping Not Supported Since 2.0
SSL Connectivity Not Supported Since 2.0
Transparent Compression Not Supported Since 2.0
Cross-SDK Data types Not Supported Since 2.0
N1QL Querying Since 2.0
Administrative Features
Administrative API Since 2.0

Contributing

Couchbase welcomes community contributions to the PHP SDK. The PHP SDK source code is available on GitHub.