datastax/php-driver
Composer 安装命令:
composer require datastax/php-driver
包简介
DataStax PHP Driver for Apache Cassandra
README 文档
README
⚠️ The PHP driver is in maintenance mode. We are still accepting pull-requests and we will occasionally release critical bug fixes, but no ongoing active development is being done currently.
DataStax PHP Driver for Apache Cassandra
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
- Support for
duration Session::execute()andSession::executeAsync()now support a simple string for the query CQL and a simple array for the query execution option- Full support for Apache Cassandra 2.2 and 3.0+
- Support for
tinyintandsmallint - Support for
dateandtime - Support for user-defined function and aggregate metadata
- Support for secondary index and materialized view metadata
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 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.
Documentation
Getting Help
- JIRA: https://datastax-oss.atlassian.net/browse/PHP
- Mailing List: https://groups.google.com/a/lists.datastax.com/forum/#!forum/php-driver-user
- DataStax Academy via Slack: https://academy.datastax.com/slack
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
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
© 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.
datastax/php-driver 适用场景与选型建议
datastax/php-driver 是一款 基于 C 开发的 Composer 扩展包,目前已累计 529.07k 次下载、GitHub Stars 达 436, 最近一次更新时间为 2015 年 04 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nosql」 「database」 「driver」 「cassandra」 「datastax」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 datastax/php-driver 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 datastax/php-driver 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 datastax/php-driver 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
The DreamFactory(tm) CouchDB Service.
Store your language lines in the database, yaml or other sources
The CodeIgniter Redis package
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Galera cluster driver for Doctrine
统计信息
- 总下载量: 529.07k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 439
- 点击次数: 26
- 依赖项目数: 19
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-04-02