danhunsaker/flysystem-redis

A Flysystem adapter for storing files in Redis

v1.0.4 2018-08-16 09:21 UTC

This package is auto-updated.

Last update: 2024-03-29 03:01:27 UTC


README

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

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.