Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Adding support for ConfigKit 2.0 #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/commands/PostInstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace app\commands;

use SideKit\Config\ConfigKit;
use Yii;
use yii\console\Controller;
use Da\Config\Configuration;

class PostInstallController extends Controller
{
Expand All @@ -14,6 +14,6 @@ class PostInstallController extends Controller
public function actionGenerateCookieValidation()
{
$key = Yii::$app->security->generateRandomString();
ConfigKit::env()->changeEnvironmentFile(['APP_COOKIE_VALIDATION_KEY' => $key]);
Configuration::env()->changeEnvironmentFile(['APP_COOKIE_VALIDATION_KEY' => $key]);
}
}
2 changes: 1 addition & 1 deletion app/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace app\models;

class User extends \yii\base\Object implements \yii\web\IdentityInterface
class User extends \yii\base\BaseObject implements \yii\web\IdentityInterface
{
public $id;
public $username;
Expand Down
9 changes: 5 additions & 4 deletions bootstrap/aliases.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;

/*
* --------------------------------------------------------------------------
* Register custom Yii aliases
* --------------------------------------------------------------------------
*
* As we have changed the structure. Modify default Yii aliases here.
*/
Yii::setAlias('@tests', ConfigKit::config()->getBasePath() . DIRECTORY_SEPARATOR . '../tests');
Yii::setAlias('@root', ConfigKit::config()->getRootPath());
Yii::setAlias('@web', ConfigKit::config()->getBasePath() . DIRECTORY_SEPARATOR . '../public');
Yii::setAlias('@tests', Configuration::app()->getBasePath() . DIRECTORY_SEPARATOR . '../tests');
Yii::setAlias('@root', Configuration::app()->getRootPath());
Yii::setAlias('@web', Configuration::app()->getBasePath() . DIRECTORY_SEPARATOR . '../public');
4 changes: 2 additions & 2 deletions bootstrap/console.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;
use yii\console\Application;

/*
Expand All @@ -14,7 +14,7 @@
* variables.
*/

$config = ConfigKit::config()->build('console', ConfigKit::env()->get('CONFIG_USE_CACHE'));
$config = Configuration::app()->build('console', Configuration::env()->get('CONFIG_USE_CACHE'));

$app = new Application($config);

Expand Down
13 changes: 6 additions & 7 deletions bootstrap/sidekit-test.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;
use App\Configuration\ConfigurationBuilder;

/*
Expand All @@ -21,7 +21,7 @@

$builder = new ConfigurationBuilder();

ConfigKit::config()
Configuration::app()
->useConfigurationBuilder($builder)
->useRootPath($root);

Expand All @@ -35,7 +35,7 @@
* as the following is specified.
*/

// ConfigKit::config()
// Configuration::app()
// ->useConfigurationBuilder($builder)
// ->useRootPath($root)
// ->useBasePath($root . '/app')
Expand All @@ -55,8 +55,7 @@
* the appropriate .env file in the path specified in SideKit.
*/

ConfigKit::env()->loadEnvironmentFrom('.env.test')->load();

Configuration::env()->loadEnvironmentFrom('.env.test')->load();
/*
* --------------------------------------------------------------------------
* Initialize constants required by Yii
Expand All @@ -65,8 +64,8 @@
* I cannot get rid of them. They are being used within core. Oh well...
*/

defined('YII_DEBUG') or define('YII_DEBUG', ConfigKit::env()->get('YII_DEBUG'));
defined('YII_ENV') or define('YII_ENV', ConfigKit::env()->get('YII_ENV'));
defined('YII_DEBUG') or define('YII_DEBUG', Configuration::env()->get('YII_DEBUG'));
defined('YII_ENV') or define('YII_ENV', Configuration::env()->get('YII_ENV'));

/*
* --------------------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions bootstrap/sidekit.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;
use App\Configuration\ConfigurationBuilder;

/*
Expand All @@ -21,7 +21,7 @@

$builder = new ConfigurationBuilder();

ConfigKit::config()
Configuration::app()
->useConfigurationBuilder($builder)
->useRootPath($root);

Expand All @@ -35,7 +35,7 @@
* as the following is specified.
*/

// ConfigKit::config()
// Configuration::app()
// ->useConfigurationBuilder($builder)
// ->useRootPath($root)
// ->useBasePath($root . '/app')
Expand All @@ -55,7 +55,7 @@
* the appropriate .env file in the path specified in SideKit.
*/

ConfigKit::env()->load();
Configuration::env()->load();

/*
* --------------------------------------------------------------------------
Expand All @@ -65,8 +65,8 @@
* I cannot get rid of them. They are being used within core. Oh well...
*/

defined('YII_DEBUG') or define('YII_DEBUG', ConfigKit::env()->get('YII_DEBUG'));
defined('YII_ENV') or define('YII_ENV', ConfigKit::env()->get('YII_ENV'));
defined('YII_DEBUG') or define('YII_DEBUG', Configuration::env()->get('YII_DEBUG'));
defined('YII_ENV') or define('YII_ENV', Configuration::env()->get('YII_ENV'));

/*
* --------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions bootstrap/test.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;
use yii\web\Application;
use App\Configuration\ConfigurationBuilder;

Expand All @@ -22,7 +22,7 @@

$builder = (new ConfigurationBuilder())->useDirectory($root . DIRECTORY_SEPARATOR . 'config');

ConfigKit::config()
Configuration::app()
->useConfigurationBuilder($builder)
->useRootPath($root);

Expand All @@ -37,7 +37,7 @@
* the appropriate .env file in the path specified in SideKit.
*/

ConfigKit::env()->loadEnvironmentFrom('.env.test')->overload();
Configuration::env()->loadEnvironmentFrom('.env.test')->overload();

/*
* --------------------------------------------------------------------------
Expand All @@ -50,7 +50,7 @@
* variables.
*/

$config = ConfigKit::config()->build('test', ConfigKit::env()->get('CONFIG_USE_CACHE'));
$config = Configuration::app()->build('test', Configuration::env()->get('CONFIG_USE_CACHE'));

$app = new Application($config);

Expand Down
4 changes: 2 additions & 2 deletions bootstrap/web.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;
use yii\web\Application;

/*
Expand All @@ -14,7 +14,7 @@
* variables.
*/

$config = ConfigKit::config()->build('web', ConfigKit::env()->get('CONFIG_USE_CACHE'));
$config = Configuration::app()->build('web', Configuration::env()->get('CONFIG_USE_CACHE'));
$app = new Application($config);

/*
Expand Down
2 changes: 1 addition & 1 deletion codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ paths:
log: tests/_output
data: tests/_data
helpers: tests/_support
bootstrap: _bootstrap.php
settings:
bootstrap: _bootstrap.php
memory_limit: 1024M
colors: true
log: true
Expand Down
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@
"vlucas/phpdotenv": "^2.4",
"league/container": "^2.2",
"symfony/finder": "^3.1",
"2amigos/yii2-config-kit": "^1.0"
"2amigos/yii2-config-kit": "^2.0"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.0.0",
"yiisoft/yii2-gii": "~2.0.0",
"yiisoft/yii2-faker": "~2.0.0",
"yiisoft/yii2-shell": "~2.0.0",
"codeception/base": "^2.2.3",
"codeception/verify": "~0.3.1",
"codeception/specify": "~0.4.3",
"codeception/codeception": "^4.1",
"codeception/verify": "^2.1",
"codeception/specify": "^1.4",
"codeception/module-asserts": "^1.3",
"codeception/module-yii2": "^1.1",
"codeception/module-phpbrowser": "^1.0",
"codeception/module-filesystem": "^1.0",
"facebook/webdriver": "^1.2",
"squizlabs/php_codesniffer": "^2.7",
"friendsofphp/php-cs-fixer": "^2.0",
Expand Down
4 changes: 2 additions & 2 deletions config/codeception/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
* advantage of its loaded configuration values
*/

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;

return ConfigKit::config()->build('test', ConfigKit::env()->get('CONFIG_USE_CACHE'));
return Configuration::app()->build('test', Configuration::env()->get('CONFIG_USE_CACHE'));
10 changes: 5 additions & 5 deletions config/console/app.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;

return [

Expand All @@ -17,13 +17,13 @@

'id' => 'application-id-console',

'basePath' => ConfigKit::config()->getBasePath(),
'basePath' => Configuration::app()->getBasePath(),

'vendorPath' => ConfigKit::config()->getVendorPath(),
'vendorPath' => Configuration::app()->getVendorPath(),

'runtimePath' => ConfigKit::config()->getRuntimePath(),
'runtimePath' => Configuration::app()->getRuntimePath(),

'language' => ConfigKit::env()->get('APP_LANGUAGE'),
'language' => Configuration::env()->get('APP_LANGUAGE'),

'bootstrap' => ['log'],

Expand Down
12 changes: 6 additions & 6 deletions config/console/components/db.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;

return [

Expand All @@ -14,13 +14,13 @@

'class' => 'yii\db\Connection',

'dsn' => ConfigKit::env()->get('DATABASE_DSN'),
'dsn' => Configuration::env()->get('DATABASE_DSN'),

'username' => ConfigKit::env()->get('DATABASE_USER'),
'username' => Configuration::env()->get('DATABASE_USER'),

'password' => ConfigKit::env()->get('DATABASE_PASSWORD'),
'password' => Configuration::env()->get('DATABASE_PASSWORD'),

'charset' => ConfigKit::env()->get('DATABASE_CHARSET'),
'charset' => Configuration::env()->get('DATABASE_CHARSET'),

'tablePrefix' => ConfigKit::env()->get('DATABASE_TABLE_PREFIX'),
'tablePrefix' => Configuration::env()->get('DATABASE_TABLE_PREFIX'),
];
4 changes: 2 additions & 2 deletions config/console/components/log.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;

return [

'traceLevel' => ConfigKit::env()->get('YII_TRACE_LEVEL'),
'traceLevel' => Configuration::env()->get('YII_TRACE_LEVEL'),

/*
* --------------------------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions config/test/app.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;

return [

Expand All @@ -17,13 +17,13 @@

'id' => 'application-id-tests',

'basePath' => ConfigKit::config()->getBasePath(),
'basePath' => Configuration::app()->getBasePath(),

'vendorPath' => ConfigKit::config()->getVendorPath(),
'vendorPath' => Configuration::app()->getVendorPath(),

'runtimePath' => ConfigKit::config()->getRuntimePath(),
'runtimePath' => Configuration::app()->getRuntimePath(),

'language' => ConfigKit::env()->get('APP_LANGUAGE'),
'language' => Configuration::env()->get('APP_LANGUAGE'),

'aliases' => [
'@bower' => '@vendor/bower-asset',
Expand Down
5 changes: 2 additions & 3 deletions config/test/components/assetManager.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;

return [

'basePath' => ConfigKit::config()->getRootPath() . '/public/assets',
'basePath' => Configuration::app()->getRootPath() . '/public/assets',

];
12 changes: 6 additions & 6 deletions config/test/components/db.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;

return [

Expand All @@ -14,13 +14,13 @@

'class' => 'yii\db\Connection',

'dsn' => ConfigKit::env()->get('DATABASE_DSN'),
'dsn' => Configuration::env()->get('DATABASE_DSN'),

'username' => ConfigKit::env()->get('DATABASE_USER'),
'username' => Configuration::env()->get('DATABASE_USER'),

'password' => ConfigKit::env()->get('DATABASE_PASSWORD'),
'password' => Configuration::env()->get('DATABASE_PASSWORD'),

'charset' => ConfigKit::env()->get('DATABASE_CHARSET'),
'charset' => Configuration::env()->get('DATABASE_CHARSET'),

'tablePrefix' => ConfigKit::env()->get('DATABASE_TABLE_PREFIX'),
'tablePrefix' => Configuration::env()->get('DATABASE_TABLE_PREFIX'),
];
5 changes: 2 additions & 3 deletions config/test/components/request.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

use SideKit\Config\ConfigKit;
use Da\Config\Configuration;

return [

'cookieValidationKey' => ConfigKit::env()->get('APP_COOKIE_VALIDATION_KEY'),
'cookieValidationKey' => Configuration::env()->get('APP_COOKIE_VALIDATION_KEY'),

'enableCsrfValidation' => false,

Expand Down
Loading