承接 evseevnn/php-cassandra-binary 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

evseevnn/php-cassandra-binary

Composer 安装命令:

composer require evseevnn/php-cassandra-binary

包简介

PHP library for Cassandra database via a binary protocol

README 文档

README

Sorry, this repository deprecated and not maintained anymore. Please use https://github.com/duoshuo/php-cassandra

Build Status

Cassandra client library for PHP, using the native binary protocol.

Roadmap for version 0.2.0

  • UUID generation
  • timestamp only with microsecond
  • using v2 protocol
  • speedup
  • the ability to specify the settings (setup default consistency level and more)
  • more fixes

Known issues

  • decimal and timestamps have bugs especially in collections (map,set,list)
  • connection handling e.g. timeouts

Installation

PHP 5.4+ is required. There is no need for additional libraries.

Append dependency into composer.json

	...
	"require": {
		...
		"evseevnn/php-cassandra-binary": "dev-master"
	}
	...

Base Using

<?php

$nodes = [
	'127.0.0.1',
	'192.168.0.2:8882' => [
		'username' => 'admin',
		'password' => 'pass'
	]
];

// Connect to database.
$database = new evseevnn\Cassandra\Database($nodes, 'my_keyspace');
$database->connect();

// Run query.
$users = $database->query('SELECT * FROM "users" WHERE "id" = :id', ['id' => 'c5420d81-499e-4c9c-ac0c-fa6ba3ebc2bc']);

var_dump($users);
/*
	result:
		array(
			[0] => array(
				'id' => 'c5420d81-499e-4c9c-ac0c-fa6ba3ebc2bc',
				'name' => 'userName',
				'email' => 'user@email.com'
			)
		)
*/

// Keyspace can be changed at runtime
$database->setKeyspace('my_other_keyspace');
// Get from other keyspace
$urlsFromFacebook = $database->query('SELECT * FROM "urls" WHERE "host" = :host', ['host' => 'facebook.com']);

Using transaction

	$database->beginBatch();
	// all INSERT, UPDATE, DELETE query append into batch query stack for execution after applyBatch
	$uuid = $database->query('SELECT uuid() as "uuid" FROM system.schema_keyspaces LIMIT 1;')[0]['uuid'];
	$database->query(
			'INSERT INTO "users" ("id", "name", "email") VALUES (:id, :name, :email);',
			[
				'id' => $uuid,
				'name' => 'Mark',
				'email' => 'mark@facebook.com'
			]
		);

	$database->query(
			'DELETE FROM "users" WHERE "email" = :email;',
			[
				'email' => 'durov@vk.com'
			]
		);
	$result = $database->applyBatch();

Supported datatypes

All types are supported.

  • ascii, varchar, text Result will be a string.
  • bigint, counter, varint Converted to strings using bcmath.
  • blob Result will be a string.
  • boolean Result will be a boolean as well.
  • decimal Converted to strings using bcmath.
  • double, float, int Result is using native PHP datatypes.
  • timestamp Converted to integer. Milliseconds precision is lost.
  • uuid, timeuuid, inet No native PHP datatype available. Converted to strings.
  • list, set Converted to array (numeric keys).
  • map Converted to keyed array.

evseevnn/php-cassandra-binary 适用场景与选型建议

evseevnn/php-cassandra-binary 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 59.91k 次下载、GitHub Stars 达 66, 最近一次更新时间为 2014 年 07 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 evseevnn/php-cassandra-binary 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 evseevnn/php-cassandra-binary 我们能提供哪些服务?
定制开发 / 二次开发

基于 evseevnn/php-cassandra-binary 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 59.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 67
  • 点击次数: 15
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 66
  • Watchers: 18
  • Forks: 31
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-07-21