yiier/yii2-merit

用于实现积分,等级功能的设计

Installs: 1 545

Dependents: 1

Suggesters: 0

Security: 0

Stars: 17

Watchers: 5

Forks: 4

Open Issues: 2

Type:yii2-extension

0.1.4 2016-07-17 14:57 UTC

This package is auto-updated.

Last update: 2024-03-25 22:44:16 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

用于实现积分,等级功能的设计

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiier/yii2-merit "*"

or add

"yiier/yii2-merit": "*"

to the require section of your composer.json file.

Migrations

Run the following command

php yii migrate --migrationPath=@yiier/merit/migrations/

Usage

Configure Controller class as follows :

use use yiier\merit\MeritBehavior;

class Controller extends \yii\web\Controller
{
    public function behaviors()
    {
        return [
            MeritBehavior::className(),
        ];
    }
}

Once the extension is installed, simply modify your application configuration as follows:

return [
    'modules' => [
        'merit' => [
            'class' => 'yiier\merit\Module',
            'types' => [1 => '积分', 2 => '声望'] // Optional
        ],
    ],
];

You can then access Merit Module through the following URL:

http://localhost/path/to/index.php?r=merit/merit
http://localhost/path/to/index.php?r=merit/merit-log
http://localhost/path/to/index.php?r=merit/merit-template