yii\base\View has special $params property. For example it's used for building breadcrumbs in default generated CRUD code templates with Gii. You can set it like this before rendering: use Yii; Yii::$app->view->params['customParam'] = 'customValue'; Inside a controller you can set it like this: $this->view->params['customParam'] = 'customValue'; Then it will be available in views (including main layout): /* @var $this yii\web\View */ echo $this->params['customParam'];