Skip to content

Commit

Permalink
Docs folder standardization and other fixes (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
luizcmarin committed Apr 22, 2024
1 parent 3202067 commit f4b2b88
Show file tree
Hide file tree
Showing 36 changed files with 326 additions and 67 deletions.
6 changes: 3 additions & 3 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ the project's leadership.

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4.0, available at
[http://contributor-covenant.org/version/1/4/][version]
[https://contributor-covenant.org/version/1/4/][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/
8 changes: 4 additions & 4 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Copyright © 2008 by Yii Software (https://www.yiiframework.com/)
Copyright © 2008 by Yii Software (<https://www.yiiframework.com/>)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yii Software nor the names of its
* Neither the name of Yii Software nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

Expand Down
38 changes: 12 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
<p align="center">
<a href="http://redis.io/" target="_blank" rel="external">
<a href="https://redis.io/" target="_blank" rel="external">
<img src="https://download.redis.io/redis.png" height="100px">
</a>
<h1 align="center">Yii DBAL Redis connection</h1>
<br>
</p>

This extension provides the [redis](http://redis.io/) connection support for the [Yii framework](http://www.yiiframework.com).
This extension provides the [redis](https://redis.io/) connection support for the [Yii framework](https://www.yiiframework.com).

[![Latest Stable Version](https://poser.pugx.org/yiisoft/db-redis/v/stable.png)](https://packagist.org/packages/yiisoft/db-redis)
[![Total Downloads](https://poser.pugx.org/yiisoft/db-redis/downloads.png)](https://packagist.org/packages/yiisoft/db-redis)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yiisoft/db-redis/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/db-redis/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/db-redis/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/db-redis/?branch=master)


## Support version

| PHP | Redis Version | CI-Actions
|:----:|:------------------------:|:---:|
|**7.4 - 8.0**| **4 - 6**|[![Build status](https://github.com/yiisoft/db-redis/workflows/build/badge.svg)](https://github.com/yiisoft/db-redis/actions?query=workflow%3Abuild) [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fdb-redis%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/db-redis/master) [![static analysis](https://github.com/yiisoft/db-redis/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/db-redis/actions?query=workflow%3A%22static+analysis%22) [![type-coverage](https://shepherd.dev/github/yiisoft/db-redis/coverage.svg)](https://shepherd.dev/github/yiisoft/db-redis)


## Installation

The package could be installed via composer:

```php
```shell
composer require yiisoft/db-redis
```

Expand Down Expand Up @@ -64,35 +62,23 @@ return [
]
];
```
### Unit testing

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```shell
./vendor/bin/phpunit
```

### Mutation testing

The package tests are checked with [Infection](https://infection.github.io/) mutation framework. To run it:
## Documentation

```shell
./vendor/bin/infection
```
- [English](docs/guide/en/README.md)
- [Português - Brasil](docs/guide/pt-BR/readme.md)
- [Internals](docs/internals.md)

### Static analysis
## Support

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:

```shell
./vendor/bin/psalm
```
If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.
You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).

### Support the project
## Support the project

[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective&logoColor=7eadf1&labelColor=555555)](https://opencollective.com/yiisoft)

### Follow updates
## Follow updates

[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)
[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat)](https://twitter.com/yiiframework)
Expand Down
20 changes: 14 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"name": "yiisoft/db-redis",
"description": "Yii Framework Redis Cache, Session and ActiveRecord extension",
"keywords": ["yii", "redis", "active-record", "cache", "session"],
"keywords": [
"yii",
"redis",
"active-record",
"cache",
"session"
],
"type": "library",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/db-redis/issues",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"forum": "https://www.yiiframework.com/forum/",
"wiki": "https://www.yiiframework.com/wiki/",
"irc": "ircs://irc.libera.chat:6697/yii",
"source": "https://github.com/yiisoft/db-redis"
},
"minimum-stability": "dev",
Expand All @@ -32,7 +38,9 @@
"yiisoft/di": "^1.0"
},
"autoload": {
"psr-4": { "Yiisoft\\Db\\Redis\\": "src" }
"psr-4": {
"Yiisoft\\Db\\Redis\\": "src"
}
},
"autoload-dev": {
"psr-4": {
Expand All @@ -49,4 +57,4 @@
"infection/extension-installer": true
}
}
}
}
5 changes: 2 additions & 3 deletions docs/guide/README.md → docs/guide/en/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Yii Framework Redis Cache, Session and ActiveRecord extension

This extension provides the [redis](http://redis.io/) key-value store support for the Yii2 framework.
This extension provides the [redis](https://redis.io/) key-value store support for the Yii2 framework.
It includes a `Cache` and `Session` storage handler and implements the `ActiveRecord` pattern that allows
you to store active records in redis.


Getting Started
---------------

* [Installation](installation.md)

Usage
-----
-----

* [Using the ActiveRecord](usage-ar.md)
* [Using commands directly](usage-commands.md)
Expand Down
6 changes: 3 additions & 3 deletions docs/guide/installation.md → docs/guide/en/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ At least redis version 2.6.12 is required for all components to work properly.

## Getting Composer package

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

```
```shell
composer require --prefer-dist yiisoft/db-redis
```

Expand All @@ -32,7 +32,7 @@ return [
```

This provides the basic access to redis storage via the `redis` application component:

```php
Yii::$app->redis->set('mykey', 'some value');
echo Yii::$app->redis->get('mykey');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ There are shortcuts available for each command supported so insted of the above
$result = $redis->hmset('test_collection', 'key1', 'val1', 'key2', 'val2');
```

For a list of available commands and their parameters see <http://redis.io/commands>.
For a list of available commands and their parameters see <https://redis.io/commands>.
3 changes: 1 addition & 2 deletions docs/guide-ja/README.md → docs/guide/ja/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Yii 2 Redis キャッシュ、セッションおよびアクティブレコード
==========================================================

このエクステンションは Yii 2 フレームワークに [redis](http://redis.io/) の「キー・値」ストレージのサポートを提供します。
このエクステンションは Yii 2 フレームワークに [redis](https://redis.io/) の「キー・値」ストレージのサポートを提供します。
エクステンションは `Cache``Session` のストレージ・ハンドラを含み、アクティブレコードを redis に保存することを可能にする `ActiveRecord` パターンを実装しています。


始めよう
--------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

## Composer パッケージを取得する

このエクステンションをインストールするのに推奨される方法は [composer](http://getcomposer.org/download/) によるものです。
このエクステンションをインストールするのに推奨される方法は [composer](https://getcomposer.org/download/) によるものです。

下記のコマンドを実行してください。

Expand Down Expand Up @@ -42,7 +42,7 @@ return [
```

これで、`redis` アプリケーション・コンポーネントによって、redis ストレージに対する基本的なアクセスが提供されるようになります。

```php
Yii::$app->redis->set('mykey', 'some value');
echo Yii::$app->redis->get('mykey');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ $result = $redis->executeCommand('hmset', ['test_collection', 'key1', 'val1', 'k
$result = $redis->hmset('test_collection', 'key1', 'val1', 'key2', 'val2');
```

利用できるコマンドとそのパラメータについては、<http://redis.io/commands> のリストを参照してください。
利用できるコマンドとそのパラメータについては、<https://redis.io/commands> のリストを参照してください。
22 changes: 22 additions & 0 deletions docs/guide/pt-BR/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Yii Framework Redis Cache, Session and ActiveRecord extension

This extension provides the [redis](https://redis.io/) key-value store support for the Yii2 framework.
It includes a `Cache` and `Session` storage handler and implements the `ActiveRecord` pattern that allows
you to store active records in redis.

Getting Started
---------------

* [Installation](installation.md)

Usage
-----

* [Using the ActiveRecord](usage-ar.md)
* [Using commands directly](usage-commands.md)

Additional topics
-----------------

* [Using the Cache component](topics-cache.md)
* [Using the Session component](topics-session.md)
41 changes: 41 additions & 0 deletions docs/guide/pt-BR/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Installation
============

## Requirements

At least redis version 2.6.12 is required for all components to work properly.

## Getting Composer package

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

```shell
composer require --prefer-dist yiisoft/db-redis
```

## Configuring application

To use this extension, you have to configure the [[Yiisoft\Db\Redis\Connection|Connection]] class in your application configuration:

```php
return [
//....
'components' => [
'redis' => [
'class' => 'Yiisoft\Db\Redis\Connection',
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
]
];
```

This provides the basic access to redis storage via the `redis` application component:

```php
Yii::$app->redis->set('mykey', 'some value');
echo Yii::$app->redis->get('mykey');
```

See [[Yiisoft\Db\Redis\Connection]] for a full list of available methods.
48 changes: 48 additions & 0 deletions docs/guide/pt-BR/topics-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Using the Cache component
=========================

To use the `Cache` component, in addition to configuring the connection as described in the [Installation](installation.md) section,
you also have to configure the `cache` component to be [[Yiisoft\Db\Redis\Cache]]:

```php
return [
//....
'components' => [
// ...
'cache' => [
'class' => 'Yiisoft\Db\Redis\Cache',
],
]
];
```

If you only use the redis cache (i.e., not using its ActiveRecord or Session), you can also configure the parameters of the connection within the
cache component (no connection application component needs to be configured in this case):

```php
return [
//....
'components' => [
// ...
'cache' => [
'class' => 'Yiisoft\Db\Redis\Cache',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
]
];
```

The cache provides all methods of the [[yii\caching\CacheInterface]]. If you want to access redis specific methods that are not
included in the interface, you can use them via [[Yiisoft\Db\Redis\Cache::$redis]], which is an instance of [[Yiisoft\Db\Redis\Connection]]:

```php
Yii::$app->cache->redis->hset('mykey', 'somefield', 'somevalue');
Yii::$app->cache->redis->hget('mykey', 'somefield');
...
```

See [[Yiisoft\Db\Redis\Connection]] for a full list of available methods.
37 changes: 37 additions & 0 deletions docs/guide/pt-BR/topics-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Using the Session component
===========================

To use the `Session` component, in addition to configuring the connection as described in the [Installation](installation.md) section,
you also have to configure the `session` component to be [[Yiisoft\Db\Redis\Session]]:

```php
return [
//....
'components' => [
// ...
'session' => [
'class' => 'Yiisoft\Db\Redis\Session',
],
]
];
```

If you only use redis session (i.e., not using its ActiveRecord or Cache), you can also configure the parameters of the connection within the
session component (no connection application component needs to be configured in this case):

```php
return [
//....
'components' => [
// ...
'session' => [
'class' => 'Yiisoft\Db\Redis\Session',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
]
];
```
Loading

0 comments on commit f4b2b88

Please sign in to comment.