Tutorial

The PHP SDK tutorial shows you how to build a complete web application that interacts with Couchbase Server. The tutorial uses a very powerful toolchain consisting of Composer, Silex and Twig to build a solid web application fast while not losing the focus on showing you how to work with the PHP SDK.

The tutorial uses the beer-sample data set that is provided with Couchbase Server to create an app that displays and manages beers and breweries. Along the way you’ll pick up concepts on querying Couchbase Server by keys or through views.

The full code sample is available on GitHub. You can clone the repository and work from there if you just want to see the finished application or get started quickly.

Before getting started, make sure you have the following dependencies in place:

  • PHP 5.3 or later. The PHP SDK itself requires PHP 5.3 or later, and most of the other dependencies require PHP 5.3.
  • Couchbase PHP SDK 2.0 : Install the appropriate .so or .dll file, depending on your platform. Earlier versions of the SDK are not capable enough becauseit uses the new Couchbase Server view-related functionality.

  • Composer : An excellent dependency manager for PHP and supported by major libraries and frameworks such as Doctrine or Symfony.