alex-kalanis / redis-wrapper
PHP wrapper for questioning Redis as file storage
v2.0.4
2024-03-29 08:45 UTC
Requires
- php: >=7.4.0
Requires (Dev)
- ext-redis: *
- alex-kalanis/kw_storage: >=5 <6
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: >=8 <=9
- predis/predis: ^2.2
- shipmonk/composer-dependency-analyser: ^1.4
Suggests
- ext-redis: Direct php library for connection to your Redis server
- alex-kalanis/kw_storage: Universal storage libraries
- predis/predis: External library for connecting your Redis cluster
README
Use Redis records as they were files. You can use either Redis module for PHP or Predis library for accesing the cluster.
Installation
composer.phar require alex-kalanis/redis-wrapper
(Refer to Composer Documentation if you are not familiar with composer)
Usages
Just only initialize wrapper with your Redis instance.
Redis module:
$redis = new \Redis(); RedisWrapper::setRedis($redis); RedisWrapper::register();
Predis library:
$redis = new \Predis\Client(); PredisWrapper::setRedisClient($redis); PredisWrapper::register();
Then for both:
file_get_contents('redis://any/key/in/redis/storage'); file_put_contents('redis://another/key/in/storage', 'add something');
For using storage just look onto kw_storage readme.