PHPackages                             widdallc/riak-php7 - 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. widdallc/riak-php7

ActiveLibrary

widdallc/riak-php7
==================

Riak client for PHP, compatible PHP7

2181PHP

Since Feb 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/widdallc/Riak-PHP7)[ Packagist](https://packagist.org/packages/widdallc/riak-php7)[ RSS](/packages/widdallc-riak-php7/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Riak Client for PHP 5.4 and up (made to work with PHP 7.4)
==========================================================

[](#riak-client-for-php-54-and-up-made-to-work-with-php-74)

**Riak PHP Client** is a client 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. Both Riak and this code is maintained by [Basho](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)

- **Release 2.x.x** requires PHP 5.4+
- **Release 1.4.x** requires PHP 5.3+

### Composer Install

[](#composer-install)

Run the following `composer` command:

```
$ composer require "widdallc/riak-php7": "1.0.*"
```

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

```
"require": {
    "widdallc/riak-php7": "1.0.*"
}
```

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

Documentation
-------------

[](#documentation)

- Master: [![Build Status](https://camo.githubusercontent.com/5fca5cfd2d6c7a5d184fbd076c9610161a75e8203020026ad5661227b08b87a8/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f626173686f2f7269616b2d7068702d636c69656e742e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/basho/riak-php-client)

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

### Releases

[](#releases)

The release tags of this project have been aligned with the major &amp; minor release versions of Riak. For example, if you are using version 1.4.9 of Riak, then you will want the latest 1.4.\* version of this library.

### Example Usage

[](#example-usage)

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

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

// define the connection info to our Riak nodes
$nodes = (new Node\Builder)
    ->onPort(10018)
    ->buildCluster(['riak1.company.com', 'riak2.company.com', 'riak3.company.com',]);

// instantiate the Riak client
$riak = new Riak($nodes);

// build a command to be executed against Riak
$command = (new Command\Builder\StoreObject($riak))
    ->buildObject('some_data')
    ->buildBucket('users')
    ->build();

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

// Retrieve the Location of our newly stored object from the Response object
$object_location = $response->getLocation();
```

Example Storing an image

```
use Widda\Riak;
use Widda\Riak\Node;
use Widda\Riak\Command;

// define the connection info to our Riak nodes
$nodes = (new Node\Builder)->onPort(8098)->buildCluster('riak1.company.com');

// instantiate the Riak client
$riak = new Riak($nodes);

$url = false;
$headers = null;

$filename = 'my_file.png';
$prefix = null;

$data = file_get_contents($filename);

if(!empty($data)) {
    $contentType = 'image/png';

    if(!empty($contentType))
        $headers = ['Content-Type' => $contentType];
    	$hash = rtrim(strtr(base64_encode(sha1_file($filename, true)), '+/', '-_'), '=');
    	$key = ($prefix ? $prefix.'_' : '').$hash;

    $command = (new Command\Builder\StoreObject($riak))
    	->buildObject($data, $headers)
        ->buildLocation($key, 'MY_RIAK_BUCKET')
        ->build();

	$response = $command->execute();

	if($response->isSuccess()) {
    	$url = $key;
	}
	else {
    	trigger_error("Erreur Riak. Code : ".$response->getCode().", Message : ".$response->getMessage());
	}
}
```

Example fetching an image

```
use Widda\Riak;
use Widda\Riak\Node;
use Widda\Riak\Command;

// define the connection info to our Riak nodes
$nodes = (new Node\Builder)->onPort(8098)->buildCluster('riak1.company.com');

// instantiate the Riak client
$riak = new Riak($nodes);

$response = (new Command\Builder\FetchObject($riak))
            ->buildLocation('MY_KEY', 'MY_RIAK_BUCKET')
            ->build()
            ->execute();

if($response->isSuccess()) {
    $data = $response->getDataObject()->getData();  //notice ->getObject() is now ->getDataObject()

    //set the image header
    header("Content-Type", $response->getContentType());

    // display the image
    echo $data;
}
```

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.0
- Development for Riak 2.1 features is underway and expected to be completed during Q2 2015

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

[](#license-and-authors)

Active

- Author: Gabriel Bouyssou ()
- Author: Timothee Planchais ()

Original

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

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

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/028a1aa19c50d07ff8e04c6175805bb14f58fbeae16773f7060dcf154f1a2697?d=identicon)[Scorpyo](/maintainers/Scorpyo)

---

Top Contributors

[![GabrielBouyssou](https://avatars.githubusercontent.com/u/12128826?v=4)](https://github.com/GabrielBouyssou "GabrielBouyssou (5 commits)")[![timmy78](https://avatars.githubusercontent.com/u/7474187?v=4)](https://github.com/timmy78 "timmy78 (1 commits)")

### Embed Badge

![Health badge](/badges/widdallc-riak-php7/health.svg)

```
[![Health](https://phpackages.com/badges/widdallc-riak-php7/health.svg)](https://phpackages.com/packages/widdallc-riak-php7)
```

PHPackages © 2026

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