DataStax PHP Driver for Apache Cassandra
Clone or download
mpenick Merge pull request #130 from datastax/doc-2089
DOC-2089: putting similar maintenance mode verbiage for PHP drivers.
Latest commit 3f49e5c Dec 6, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
ext Correct static build for extension Oct 11, 2017
features PHP-196: Updating building and testing documentation Aug 8, 2017
lib Updating submodule to cpp-driver v2.9.0 Jun 26, 2018
support test: PHP-207 - Correcting cluster naming in CCM support bridge Mar 7, 2018
tests PHP-118 - Unable to bind list values using global type constants Aug 4, 2017
.clang-format add a quick note on coding style May 21, 2015
.gitignore PHP-159 - Fix composer dependencies (#117) Aug 4, 2017
.gitmodules add ccp-driver submodule Mar 27, 2015
.travis.yml test: Updating TravisCI to use full virtualization Mar 7, 2018 Updated version and changelog for v1.3.2 Aug 11, 2017 fix spacing May 22, 2015
LICENSE Updating and adding copyright header Feb 11, 2016 Update installation instructions Jun 26, 2018
Rakefile PHP-155: Support for PHP v7.1.x Aug 4, 2017
Vagrantfile [ci skip] add php-dbg package to vagrant box Jul 28, 2015
appveyor.yml PHP-155: Support for PHP v7.1.x Aug 4, 2017
behat.yml PHP-155: Support for PHP v7.1.x Aug 4, 2017
build.yaml PHP-204: update build.yaml to include a connection test Oct 11, 2017
composer.json PHP-159 - Fix composer dependencies (#117) Aug 4, 2017
docs.yaml DOC-2089: putting similar maintenance mode verbiage for PHP drivers. Dec 3, 2018
doxyfile Added doxyfile for documentation Sep 15, 2015
doxygen.rb PHP-184 - Remove {@inheritDoc} from method parameters Apr 28, 2017
phpunit.xml.dist Remove integration test listener in favor of clean up singleton Feb 8, 2016

DataStax PHP Driver for Apache Cassandra

Build Status: Linux Build Status: Windows

A modern, feature-rich and highly tunable PHP client library for Apache Cassandra 2.1+ using exclusively Cassandra's binary protocol and Cassandra Query Language v3. Use the DSE PHP driver for better compatibility and support for DataStax Enterprise.

This is a wrapper around the DataStax C/C++ Driver for Apache Cassandra.

Note: DataStax products do not support big-endian systems.

Getting the Driver

Binary versions of the driver, available for multiple operating systems and multiple versions of PHP, can be obtained from DataStax download server. The source code is made available via GitHub. If you're using DataStax Enterprise use the DSE PHP driver instead.

Note: The driver extension is a wrapper around the DataStax C/C++ Driver for Apache Cassandra and is a requirement for proper installation of the PHP extension binaries. Ensure these dependencies are met before proceeding.

What's new in v1.2.0/v1.3.0


This driver works exclusively with the Cassandra Query Language v3 (CQL3) and Cassandra's native protocol. The current version works with:

  • Apache Cassandra versions 2.1, 2.2 and 3.0+
  • PHP 5.6, PHP 7.0, and PHP 7.1
    • 32-bit (x86) and 64-bit (x64)
    • Thread safe (TS) and non-thread safe (NTS)
  • Compilers: GCC 4.1.2+, Clang 3.4+, and MSVC 2010/2012/2013/2015

If using DataStax Enterprise the DSE PHP driver provides more features and better compatibility.


Getting Help

Feedback Requested

Help us focus our efforts! Provide your input on the PHP Driver Platform and Runtime Survey (we kept it short).

Quick Start

$cluster   = Cassandra::cluster()                 // connects to localhost by default
$keyspace  = 'system';
$session   = $cluster->connect($keyspace);        // create session, optionally scoped to a keyspace
$statement = new Cassandra\SimpleStatement(       // also supports prepared and batch statements
    'SELECT keyspace_name, columnfamily_name FROM schema_columnfamilies'
$future    = $session->executeAsync($statement);  // fully asynchronous and easy parallel execution
$result    = $future->get();                      // wait for the result, with an optional timeout

foreach ($result as $row) {                       // results and rows implement Iterator, Countable and ArrayAccess
    printf("The keyspace %s has a table called %s\n", $row['keyspace_name'], $row['columnfamily_name']);


pecl install cassandra

Read detailed instructions on building and installing the extension


Read our contribution policy for a detailed description of the process.

Code examples

The DataStax PHP Driver uses the amazing Behat Framework for both end-to-end, or acceptance testing and documentation. All of the features supported by the driver have appropriate acceptance tests with easy-to-copy code examples in the features/ directory.

Running tests

For your convenience a Vagrantfile with configuration ready for testing is available. To execute tests, run the following:

git clone
cd php-driver
git submodule update --init
vagrant up
vagrant ssh

Once you've logged in to the vagrant VM, run:

cd /usr/local/src/php-driver


Copyright 2015-2017 DataStax, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.