Giter VIP home page Giter VIP logo

php-driver's Introduction

DataStax PHP Driver for Apache Cassandra

Build Status

A modern, feature-rich and highly tunable PHP client library for Apache Cassandra (1.2+) and DataStax Enterprise (3.1+) using exclusively Cassandra's binary protocol and Cassandra Query Language v3.

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

What's new in v1.1.0:

Feedback Requested

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

Quick Start

<?php
$cluster   = Cassandra::cluster()                 // connects to localhost by default
                 ->build();
$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']);
}

Installation

pecl install cassandra

Read detailed instructions on building and installing the extension

Compatibility

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

  • Apache Cassandra versions 1.2, 2.0 and 2.1
  • DataStax Enterprise 3.1, 3.2, 4.0 and 4.5
  • PHP 5.5+ and PHP 7.0+
  • Compilers: GCC 4.1.2+, Clang 3.4+, and MSVC 2010/2012/2013/2015

Contributing

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 https://github.com/datastax/php-driver.git
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
./bin/behat
./bin/phpunit

Copyright

Copyright 2015-2016 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

http://www.apache.org/licenses/LICENSE-2.0

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.

php-driver's People

Contributors

mpenick avatar avalanche123 avatar stof avatar mikefero avatar craveica avatar tony2001 avatar developerius avatar dylwylie avatar frank-borkin avatar mshuler avatar beccam avatar samob25 avatar beautivile avatar

Stargazers

Peter Böthig avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.