YII2 : Can we configure session setting without using configuration file (main.php)

Following configuration should be in main.php under session array.

‘class’ => ‘yii\web\DbSession’,

  'sessionTable' => 'session', 

Can we configure these settings outside of config folder or anywhere in yii2. ?

Yes. Why?