Did some modifications to make it working with yii2