diff --git a/composer.json b/composer.json index 964bc3b..5b3ada9 100644 --- a/composer.json +++ b/composer.json @@ -42,14 +42,32 @@ "homepage": "http://hiqdev.com/" } ], + "require": { + "php": "^5.6|^7.0", + "yiisoft/yii2": "^2.0", + "hiqdev/composer-config-plugin": "<2.0 || dev-master" + }, "require-dev": { "hiqdev/hidev-php": "<2.0 || dev-master", "hiqdev/hidev-hiqdev": "<2.0 || dev-master" }, "autoload": { "psr-4": { - "hisite\\": "src", - "hiqdev\\hisite\\core\\": "src" + "hisite\\": "src" + } + }, + "extra": { + "config-plugin": { + "params": "src/config/params.php", + "hisite": "src/config/hisite.php", + "hidev": "src/config/hidev.php" + } + }, + "minimum-stability": "dev", + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org" } - } + ] } diff --git a/src/config/hisite.php b/src/config/hisite.php new file mode 100644 index 0000000..c971fb6 --- /dev/null +++ b/src/config/hisite.php @@ -0,0 +1,93 @@ + 'hisite', + 'name' => 'HiSite', + 'basePath' => dirname(__DIR__), + 'viewPath' => '@hisite/views', + 'vendorPath' => '@root/vendor', + 'runtimePath' => '@root/runtime', + 'controllerNamespace' => 'hisite\controllers', + 'bootstrap' => ['log', 'themeManager', 'language', 'menuManager'], + 'aliases' => [ + '@bower' => '@vendor/bower-asset', + '@npm' => '@vendor/npm-asset', + '@vendor/bower' => '@vendor/bower-asset', + '@vendor/npm' => '@vendor/npm-asset', + ], + 'components' => [ + 'request' => [ + 'enableCsrfCookie' => true, /// XXX TO BE DISABLED + 'cookieValidationKey' => $params['cookieValidationKey'], + ], + 'mailer' => [ + 'class' => \yii\swiftmailer\Mailer::class, + 'viewPath' => '@hisite/mail', + ], + 'log' => [ + 'traceLevel' => defined('YII_DEBUG') && YII_DEBUG ? 3 : 0, + 'targets' => [ + 'default' => [ + 'class' => \yii\log\FileTarget::class, + 'levels' => ['error', 'warning'], + ], + ], + ], + 'errorHandler' => [ + 'errorAction' => 'site/error', + ], + 'urlManager' => [ + 'class' => \yii\web\UrlManager::class, + 'enablePrettyUrl' => true, + 'showScriptName' => false, + 'enableStrictParsing' => false, + 'rules' => [ + '<_c:[\w\-]+>/' => '<_c>/view', + '<_c:[\w\-]+>' => '<_c>/index', + '<_c:[\w\-]+>/<_a:[\w\-]+>/' => '<_c>/<_a>', + ], + ], + 'themeManager' => [ + 'class' => \hiqdev\thememanager\ThemeManager::class, + ], + 'menuManager' => [ + 'class' => \hiqdev\menumanager\MenuManager::class, + 'items' => [ + 'sidebar' => [ + 'items' => [], + ], + 'breadcrumbs' => [ + 'saveToView' => 'breadcrumbs', + ], + ], + ], + ], + 'modules' => [ + 'language' => [ + 'class' => \hiqdev\yii2\language\Module::class, + 'languages' => [ + 'en' => 'English', + 'ru' => 'Русский', + ] + ], + ], +]; + +if (defined('YII_DEBUG') && YII_DEBUG) { + $config['bootstrap']['debug'] = 'debug'; + $config['modules']['debug'] = [ + 'class' => \yii\debug\Module::class, + 'allowedIPs' => $params['debug_allowed_ips'], + ]; +} + +return $config; diff --git a/src/config/params.php b/src/config/params.php new file mode 100644 index 0000000..1457f8f --- /dev/null +++ b/src/config/params.php @@ -0,0 +1,18 @@ + '', + 'adminEmail' => 'admin@example.com', + + 'cookieValidationKey' => '', + 'debug_allowed_ips' => [], +];