I am loging out user through following code. This is my view code behind logout button:
\"&g
Following works too assuming you might extra class and data-method attribute.
data-method
= Html::a( 'Logout (' . Yii::$app->user->identity->username . ')', ['/site/logout'], ['class' => 'ui inverted button', 'data-method' => 'post'] ); ?>