A Flysystem adapter for storing files in Redis
PHP
Switch branches/tags
Clone or download
danhunsaker Add PHP7 to Travis tests; Alias StreamPolyfill trait
Signed-off-by: Dan Hunsaker <danhunsaker@gmail.com>
Latest commit bfdd5df May 18, 2016

README.md

Flysystem Adapter for Redis

Join the chat at https://gitter.im/danhunsaker/flysystem-redis

Latest Version Software License Build Status Total Downloads

This is a Redis adapter for Flysystem.

Installation

Composer is the best way, as with all of Flysystem!

composer require danhunsaker/flysystem-redis

Usage

The usual. Create a client instance, pass it to the adapter, and pass that to the filesystem:

use Predis\Client;
use League\Flysystem\Filesystem;
use Danhunsaker\Flysystem\Redis\RedisAdapter;

$redis = new Client();
$adapter = new RedisAdapter($redis);
$filesystem = new Filesystem($adapter);

If Predis's assumed defaults of 127.0.0.1 and 6379 for host and port (respectively) aren't sufficient, you can pass your own values, just as you normally would when setting up Predis elsewhere in your projects:

use Predis\Client;
use League\Flysystem\Filesystem;
use Danhunsaker\Flysystem\Redis\RedisAdapter;

$redis = new Client([
    'scheme' => 'tcp',
    'host'   => '10.0.0.1',
    'port'   => 6379,
]);
$adapter = new RedisAdapter($redis);
$filesystem = new Filesystem($adapter);

See the Predis docs for more on how to set it up...

And head to GitHub for everything else.