clusterpoint/php-client-api-v4

4.0.28 2016-11-17 13:33 UTC

README

License Total Downloads Latest Stable Version Latest Unstable Version

Clusterpoint 是一个以创新云基础分布式架构、快速处理速度和灵活的“按使用付费”定价模式而闻名的 NoSQL 文档数据库。该数据库还提供适合许多流行现代编程语言的开发者友好 API,包括 PHP — 这是本文件的焦点。它在 NoSQL 数据库中全面支持符合 ACID 交易协议的功能,使得产品在数据完整性是必需的情况下非常有用。

Clusterpoint 第四版最近引入了具有计算能力的独特的 JavaScript/SQL 查询语言,允许您创建强大的查询来存储、检索和转换数据。PHP API 足够灵活,允许您使用接口方法或原始 JS/SQL 查询来完成数据库任务。使用哪种方法的最终决定取决于程序员的偏好和特定的开发场景。

Clusterpoint 4.x PHP 客户端 API

官方文档

API 文档可以在Clusterpoint 网站上找到。

需求

PHP >= 5.4.0
cURL PHP Extension
Composer

入门

  1. 注册 Clusterpoint – 在开始之前,您需要注册 Clusterpoint 账户并检索您的 Clusterpoint 凭证
  2. 最低要求 – 要运行 PHP 客户端 API,您的系统需要满足 最低要求,包括具有 **PHP >= 5.4.0 并编译了 cURL 扩展和 cURL 4.0.2+。
  3. 安装 APIComposer 是安装 PHP 客户端 API 的正确方法。
    composer require clusterpoint/php-client-api-v4
  4. 发布配置文件 - 这是一个可选步骤,您可以在工作流程中传递访问点,但这可能会使您的开发过程更简单。
    php -r "copy('vendor/clusterpoint/php-client-api-v4/src/config.example', 'clusterpoint.php');"
  5. 访问 – 您可以在 Clusterpoint\Client 类构造中传递凭证,或在您的项目根目录中使用 clusterpoint.php 来管理您的访问点。

快速示例

<?php
require 'vendor/autoload.php';
// or if you installed api without composer:
// require 'api_install_folder/Clusterpoint.php'

use Clusterpoint\Client;

//Initialize the service
$cp = new Client([
	'host' => 'https://api-eu.clusterpoint.com/v4',
	'account_id' => '1',
	'username' => 'root',
	'password' => 'password',
	'debug' => true,
]);

// Set the database.collection to initalize the query builder for it.
$bikes = $cp->database("shop.bikes");

// Build your query
$results = $bikes->where('color', 'red')
	->where('availability', true)
	->limit(5)
	->groupBy('category')
	->orderBy('price')
	->select(['name', 'color', 'price', 'category'])
	->get();

// Access your results
echo "First bike price: ".$results[0]->price;

支持、功能请求和错误报告

许可

Clusterpoint 4.x PHP 客户端 API 是开源软件,根据MIT 许可证授权。