zacksleo/yii-gitlab-error-behavior

yii2为gitlab的错误行为

安装: 836

依赖项: 0

建议者: 0

安全: 0

星标: 1

关注者: 3

分支: 0

开放问题: 0

类型:yii2-extension

1.0.6 2017-04-29 16:20 UTC

This package is auto-updated.

Last update: 2024-09-08 07:11:19 UTC


README

yii1的gitlab错误行为

Latest Stable Version Total Downloads License

使用方法

通过Composer安装

  composer require zacksleo/yii-gitlab-error-behavior --prefer-dist 
  

设置组件

    'errorHandler' => [
        'errorAction' => 'site/error',
    ],

在SiteController中设置行为

设置apiRoot、privateToken和projectName

    public function behaviors()
    {
        return array(
            'error' => array(
                'class' => 'webroot.vendor.zacksleo.yii-gitlab-error-behavior.src.ErrorBehavior',
                'apiRoot' => 'http://gitlab.com/api/v3/',
                'privateToken' => '{privateToken}',
                'projectName' => '{demo/project}'
            )
        );
    }   
    
    public function onBeforeAction($event)
    {
        $this->raiseEvent('onBeforeAction', $event);
    }    


    public function actionError()
    {
        if ($error = Yii::app()->errorHandler->error) {
            $this->onBeforeAction(new CEvent($this));            
            $this->renderPartial('error', $error);            
        }
    }

屏幕截图