PHPackages                             start2004/riak-php-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. start2004/riak-php-client

ActiveLibrary[Database &amp; ORM](/categories/database)

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.

3.5.3.1(5y ago)119Apache-2.0PHPPHP &gt;=7.2

Since Feb 12Pushed 5y agoCompare

[ Source](https://github.com/start2004/riak-php-client)[ Packagist](https://packagist.org/packages/start2004/riak-php-client)[ Docs](http://basho.com/riak/)[ RSS](/packages/start2004-riak-php-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (29)Used By (0)

Riak Client for PHP
===================

[](#riak-client-for-php)

[![Packagist](https://camo.githubusercontent.com/b72f85cdd1d2eea054dd8ca3844322b278758d8f71cc8cce6e7c227a6a997aea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f70656e2d616461707465722f7269616b2d7068702d636c69656e742e7376673f6d61784167653d32353932303030)](https://packagist.org/packages/start2004/riak-php-client)

**Riak PHP Client** is a library which makes it easy to communicate with [Riak](http://basho.com/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](https://github.com/basho/riak-phppb-client). Both Riak and this library are maintained by [Basho Technologies](http://www.basho.com/).

To see other clients available for use with Riak visit our [Documentation Site](http://docs.basho.com/riak/latest/dev/using/libraries)

1. [Installation](#installation)
2. [Documentation](#documentation)
3. [Contributing](#contributing)
    - [An honest disclaimer](#an-honest-disclaimer)
4. [Roadmap](#roadmap)
5. [License and Authors](#license-and-authors)

Installation
------------

[](#installation)

### Dependencies

[](#dependencies)

- PHP 7.2+
- PHP Extensions: curl, json and openssl \[required for security features\]
- Riak 2.1+
- [Composer PHP Dependency Manager](https://getcomposer.org/)

### Composer Install

[](#composer-install)

This library has been added to [Packagist](https://packagist.org/packages/basho/) to simplify the installation process. Run the following [composer](https://getcomposer.org/) 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
-------------

[](#documentation)

A fully traversable version of the API documentation for this library can be found on [Github Pages](http://basho.github.io/riak-php-client).

### Example Usage

[](#example-usage)

Below is a short example of using the client. More substantial sample code is available [in examples](/examples).

#### 8087

[](#8087)

requires allegro/protobuf: &gt;= 0.12.3, `docker-php-ext-install protobuf`

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

abstract class ProtobufMessage
{
    ...
}
```

##### code

[](#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

[](#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
------------

[](#contributing)

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

### An honest disclaimer

[](#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
-------

[](#roadmap)

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

License and Authors
-------------------

[](#license-and-authors)

Merge:

- basho/riak-pb ()
- open-adapter/riak-php-client ()

Active:

- Author: Przemyslaw Pastusiak ()

Original:

- Author: Christopher Mancini ()
- Author: Alex Moore ()
- Author: Luke Bakken ()

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor4

4 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~105 days

Recently: every ~347 days

Total

25

Last Release

1942d ago

Major Versions

v1.4.2 → 2.0.02015-03-25

v1.4.3 → v2.0.32015-08-21

v2.0.3 → v3.0.0-alpha2015-09-24

v2.1.1 → v3.0.0-beta2015-12-21

2.1.x-dev → v3.0.12016-01-13

PHP version history (3 changes)v1.4.0PHP &gt;=5.3.0

2.0.0PHP &gt;=5.4

3.5.2PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d889cf6a3348d10f0292de7936d3362f9a512b82bda09970ede16c3924d03790?d=identicon)[start2004](/maintainers/start2004)

---

Top Contributors

[![christophermancini](https://avatars.githubusercontent.com/u/131620?v=4)](https://github.com/christophermancini "christophermancini (35 commits)")[![alexmoore](https://avatars.githubusercontent.com/u/1438?v=4)](https://github.com/alexmoore "alexmoore (25 commits)")[![kevburnsjr](https://avatars.githubusercontent.com/u/20638?v=4)](https://github.com/kevburnsjr "kevburnsjr (16 commits)")[![kuenishi](https://avatars.githubusercontent.com/u/11440?v=4)](https://github.com/kuenishi "kuenishi (15 commits)")[![debo](https://avatars.githubusercontent.com/u/493257?v=4)](https://github.com/debo "debo (15 commits)")[![massung](https://avatars.githubusercontent.com/u/746946?v=4)](https://github.com/massung "massung (12 commits)")[![dshafik](https://avatars.githubusercontent.com/u/58074?v=4)](https://github.com/dshafik "dshafik (7 commits)")[![eveiga](https://avatars.githubusercontent.com/u/777195?v=4)](https://github.com/eveiga "eveiga (7 commits)")[![lastzero](https://avatars.githubusercontent.com/u/301686?v=4)](https://github.com/lastzero "lastzero (5 commits)")[![lukebakken](https://avatars.githubusercontent.com/u/514926?v=4)](https://github.com/lukebakken "lukebakken (5 commits)")[![MightyE](https://avatars.githubusercontent.com/u/881912?v=4)](https://github.com/MightyE "MightyE (4 commits)")[![dreverri](https://avatars.githubusercontent.com/u/34737?v=4)](https://github.com/dreverri "dreverri (4 commits)")[![beerriot](https://avatars.githubusercontent.com/u/190975?v=4)](https://github.com/beerriot "beerriot (3 commits)")[![Bilge](https://avatars.githubusercontent.com/u/470626?v=4)](https://github.com/Bilge "Bilge (3 commits)")[![abelperez](https://avatars.githubusercontent.com/u/113250?v=4)](https://github.com/abelperez "abelperez (2 commits)")[![mbbroberg](https://avatars.githubusercontent.com/u/1744971?v=4)](https://github.com/mbbroberg "mbbroberg (2 commits)")[![pfote](https://avatars.githubusercontent.com/u/134523?v=4)](https://github.com/pfote "pfote (2 commits)")[![wojons](https://avatars.githubusercontent.com/u/139396?v=4)](https://github.com/wojons "wojons (2 commits)")[![drlinux](https://avatars.githubusercontent.com/u/954041?v=4)](https://github.com/drlinux "drlinux (1 commits)")[![dmitrizagidulin](https://avatars.githubusercontent.com/u/947005?v=4)](https://github.com/dmitrizagidulin "dmitrizagidulin (1 commits)")

---

Tags

clientdatadatabasenosqldriverriakdatatypebashokvcrdt

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/start2004-riak-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/start2004-riak-php-client/health.svg)](https://phpackages.com/packages/start2004-riak-php-client)
```

###  Alternatives

[basho/riak

Official Riak client for PHP

159246.7k7](/packages/basho-riak)[datastax/php-driver

DataStax PHP Driver for Apache Cassandra

437521.5k19](/packages/datastax-php-driver)[mroosz/php-cassandra

A pure-PHP client for Apache Cassandra and ScyllaDB with support for CQL binary protocol v3, v4 and v5 (Cassandra 2.1+ incl. 3.x-5.x; ScyllaDB 6.2 and 2025.x), synchronous and asynchronous APIs, prepared statements, batches, result iterators, object mapping, SSL/TLS, and LZ4 compression.

205.6k2](/packages/mroosz-php-cassandra)[tbolier/php-rethink-ql

A clean and solid RethinkDB driver for PHP.

5211.7k](/packages/tbolier-php-rethink-ql)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
