定制 start2004/riak-php-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

start2004/riak-php-client

Composer 安装命令:

composer require start2004/riak-php-client

包简介

UnOfficial Riak client for PHP7, merge `basho/riak-pb` and `open-adapter/riak-php-client`, Fix for the error "Cannot use Riak\Object as Object because 'Object' is a special class name", support 8087 or 8098.

README 文档

README

Packagist

Riak PHP Client is a library which makes it easy to communicate with Riak, an open source, distributed database that focuses on high availability, horizontal scalability, and predictable latency. This library communicates with Riak's HTTP interface using the cURL extension. If you want to communicate with Riak using the Protocol Buffers interface, use the Official PHP PB Client. Both Riak and this library are maintained by Basho Technologies.

To see other clients available for use with Riak visit our Documentation Site

  1. Installation
  2. Documentation
  3. Contributing
  4. Roadmap
  5. License and Authors

Installation

Dependencies

Composer Install

This library has been added to Packagist to simplify the installation process. Run the following composer command:

$ composer require "start2004/riak-php-client": "3.*"

Alternately, manually add the following to your composer.json, in the require section:

"require": {
    "start2004/riak-php-client": "3.*"
}

And then run composer update to ensure the module is installed.

Documentation

A fully traversable version of the API documentation for this library can be found on Github Pages.

Example Usage

Below is a short example of using the client. More substantial sample code is available in examples.

8087

requires allegro/protobuf: >= 0.12.3, docker-php-ext-install protobuf

https://packagist.org/packages/allegro/php-protobuf

https://github.com/allegro/php-protobuf

die("This is a stub file for IDEs, don't use it directly!");

abstract class ProtobufMessage
{
    ...
}
code
// lib classes are included via the Composer autoloader files
use Start2004\Riak;
use Start2004\Riak\Node;
use Start2004\Riak\Command;

// define the connection info to our Riak nodes
$node = (new Node\Builder)
    ->atHost('riak domain')
    ->onPort(8087)
    ->build();

// instantiate the Riak client
$riak = new Riak([$node], [], new Riak\Api\Pb());
$bucket = new Riak\Bucket("bucket name");

// location
$location = new Riak\Location("key name", $bucket);

// dataObject
$dataObject = new Riak\DataObject("store data");
$dataObject->setContentType("text/html");
$dataObject->setContentEncoding("identity");

// build a command to be executed against Riak
$command = (new Command\Builder\StoreObject($riak))
    ->withObject($dataObject)
    ->atLocation($location);

// store
$store = new Command\DataObject\Store($command);
    
// Receive a response object
$response = $store->execute();



// fetch object
$command = (new Command\Builder\FetchObject($riak))
    ->atLocation($location)
    ->build();
$response = $command->execute();

// data
if($response->getCode() == "200"){
    $dataObject = $response->getDataObject();
    $contentType = $dataObject->getContentType();
    $data = $dataObject->getData();
} else {}



// delete object
$command = (new Command\Builder\DeleteObject($riak))
    ->atLocation($location);
$delete = new Command\DataObject\Delete($command);
$response = $delete->execute();

// delete result
return !($response->getCode() === 404);

8098

// lib classes are included via the Composer autoloader files
use Start2004\Riak;
use Start2004\Riak\Node;
use Start2004\Riak\Command;

// define the connection info to our Riak nodes
$node = (new Node\Builder)
    ->atHost('riak domain')
    ->onPort(8098)
    ->build();

// instantiate the Riak client
$riak = new Riak([$node]);
$bucket = new Riak\Bucket("bucket name");

// location
$location = new Riak\Location("key name", $bucket);

// dataObject
$dataObject = new Riak\DataObject("store data");
$dataObject->setContentType("text/html");
$dataObject->setContentEncoding("identity");

// build a command to be executed against Riak
$command = (new Command\Builder\StoreObject($riak))
    ->withObject($dataObject)
    ->atLocation($location)
    ->build();

// Receive a response object
$response = $command->execute();

Contributing

This repo's maintainers are engineers at Basho and we welcome your contribution to the project! You can start by reviewing CONTRIBUTING.md for information on everything from testing to coding standards.

An honest disclaimer

Due to our obsession with stability and our rich ecosystem of users, community updates on this repo may take a little longer to review.

The most helpful way to contribute is by reporting your experience through issues. Issues may not be updated while we review internally, but they're still incredibly appreciated.

Thank you for being part of the community! We love you for it.

Roadmap

  • Current develop & master branches contain feature support for Riak version 2.1+
  • Add support for Riak TS Q2 2016

License and Authors

Merge:

Active:

Original:

Copyright (c) 2015 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"). For more details, see License.

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2021-01-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固