yii2 Session Creating and editing session variables that are arrays


Example

Save the session variable as a variable.

$session = Yii::$app->session;

$sess = $session['keys'];

Then create or update the array value you want

$sess['first'] = 'abc';

And finally save to the session variable

$session['keys'] = $sess