Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yiisoft/yii2-redis
Yii 2 Redis extension.
https://github.com/yiisoft/yii2-redis
hacktoberfest redis yii yii2
Last synced: 6 days ago
JSON representation
Yii 2 Redis extension.
- Host: GitHub
- URL: https://github.com/yiisoft/yii2-redis
- Owner: yiisoft
- License: bsd-3-clause
- Created: 2013-11-25T01:40:18.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-07-05T21:33:30.000Z (6 months ago)
- Last Synced: 2024-10-29T14:35:34.568Z (about 2 months ago)
- Topics: hacktoberfest, redis, yii, yii2
- Language: PHP
- Homepage: http://www.yiiframework.com
- Size: 9.8 MB
- Stars: 451
- Watchers: 49
- Forks: 184
- Open Issues: 33
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
Redis Cache, Session and ActiveRecord for Yii 2
This extension provides the [redis](https://redis.io/) key-value store support for the [Yii framework 2.0](https://www.yiiframework.com).
It includes a `Cache` and `Session` storage handler and implements the `ActiveRecord` pattern that allows
you to store active records in redis.For license information check the [LICENSE](LICENSE.md)-file.
Documentation is at [docs/guide/README.md](docs/guide/README.md).
[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-redis/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-redis)
[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-redis/downloads.png)](https://packagist.org/packages/yiisoft/yii2-redis)
[![Build status](https://github.com/yiisoft/yii2-redis/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-redis/actions?query=workflow%3Abuild)Requirements
------------At least redis version 2.6.12 is required for all components to work properly.
Installation
------------The preferred way to install this extension is through [composer](https://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist yiisoft/yii2-redis:"~2.0.0"
```or add
```json
"yiisoft/yii2-redis": "~2.0.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:
```php
return [
//....
'components' => [
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
]
];
```**SSL configuration** example:
```php
return [
//....
'components' => [
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => 'localhost',
'port' => 6380,
'database' => 0,
'useSSL' => true,
// Use contextOptions for more control over the connection (https://www.php.net/manual/en/context.php), not usually needed
'contextOptions' => [
'ssl' => [
'local_cert' => '/path/to/local/certificate',
'local_pk' => '/path/to/local/private_key',
],
],
],
],
];
```**Configuring The Connection Scheme**
By default, Redis will use the tcp scheme when connecting to your Redis server; however, you may use TLS / SSL encryption by specifying a scheme configuration option in your application configuration:
```php
return [
//....
'components' => [
'redis' => [
//....
'scheme' => 'tls'
]
]
];
```