nuwber / yii2-phpredis
yii2 with phpredis
Installs: 22 675
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 15
Open Issues: 0
Requires
- php: >=7.2
- ext-json: *
- ext-redis: >=3
- yiisoft/yii2: ~2.0.14
Requires (Dev)
- phpunit/phpunit: >=8.0
- yiisoft/yii2-redis: ^2.0
This package is auto-updated.
Last update: 2024-12-13 17:27:20 UTC
README
This extension provides the redis key-value store support for the Yii framework 2.0.
It includes a Cache
and Session
storage handler in redis.
Notice: THIS REPO DOES NOT SUPPORT ACTIVE RECORD.
Installation
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist nuwber/yii2-phpredis
or add
"nuwber/yii2-phpredis": "^2.0"
to the require section of your composer.json.
Configuration
To use this extension, you have to configure the Connection class in your application configuration:
return [ 'components' => [ 'redis' => [ 'class' => \nuwber\yii2redis\Connection::class, 'hostname' => 'localhost', 'port' => 6379, 'database' => 0, ], 'cache' => [ 'class' => \nuwber\yii2redis\Cache::class, ], 'session' => [ 'class' => \nuwber\yii2redis\Session::class, ], ], ];
Run unit test
You can specific your redis config
$ cp tests/config.php tests/config-local.php
and Run
$ ./vendor/bin/phpunit
Performance test
$ php tests/performance.php