postor/yii2-for-sae

The adapt for Yii2 framework to run on sina app engine.

This package's canonical repository appears to be gone and the package has been frozen as a result.

Installs: 171

Dependents: 0

Suggesters: 0

Security: 0

Stars: 28

Watchers: 9

Forks: 11

Open Issues: 0

Type:yii2-extension

0.0.5 2015-06-24 09:30 UTC

This package is not auto-updated.

Last update: 2024-02-21 06:20:25 UTC


README

This is using saestorage for asset publishing.使用saestorage实现资源发布功能

Installation安装步骤:

The preferred way to install this extension is through composer.推荐使用composer

Either run命令行输入并运行

php composer.phar require "postor/yii2-for-sae" "*"

or add或者在配置文件composer.json中添加

"postor/yii2-for-sae": "*"

to the require section of your composer.json file.

Usage使用方法:

1.create a saestorage domain named 'assets' in SAE admin, this can be another name but need to be configed as assetDomain.

在sae后台开启storage,并建立一个domain叫做‘assets’,如果使用别的名字需要在配置中使用assetDomain来配置

2.config 配置

// config/web.php
// change all file operations to db or seastorage or kvdb
//修改所有文件操作到数据库,或者saestorage或者kvdb
...
    'components' => [
        //cache to db缓存到db
        'cache' => [
            'class' => 'yii\caching\DbCache',
        ],
        //sea mysql配置sae的mysql
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host='.SAE_MYSQL_HOST_M.';port='.SAE_MYSQL_PORT.';dbname='.SAE_MYSQL_DB,
            'username' => SAE_MYSQL_USER,
            'password' => SAE_MYSQL_PASS,
            'charset' => 'utf8',
            'tablePrefix' => 'scd_',
        ],
        //use seastorage for assets使用sae发布资源
        'assetManager' =>[
        	'class'=>'postor\sae\SaeAssetManager',
        	'assetDomain'=>'assets',
        	'converter' => [
        		'class' => 'yii\web\AssetConverter',
        	],
        ],
        //log to db日志也修改到db
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\DbTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
    ]

demo: http://yii2postor.sinaapp.com/web/?r=admin