Skip to content

danhunsaker/flysystem-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flysystem Adapter for Redis

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.