PHP code example of postor / yii2-for-sae

1. Go to this page and download the library: Download postor/yii2-for-sae library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

postor / yii2-for-sae example snippets



// 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'],
                ],
            ],
        ],
    ]

php composer.phar