2017 © Pedro Peláez
 

yii-extension yii-whoops

Whoops integration class into Yii Framework 1.1

image

igorsantos07/yii-whoops

Whoops integration class into Yii Framework 1.1

  • Tuesday, September 30, 2014
  • by igorsantos07
  • Repository
  • 2 Watchers
  • 8 Stars
  • 2,208 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 4 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Yii Error Handler with Whoops

Integrates the Whoops library into Yii 1.1 and enables further error processing., (*1)

Current CErrorHandler behaviour is to use internal error views to display development problems, such as the error and exception views. If you're not in debug mode, it will simply call the vanilla error action and display less stuff in the screen so your users don't get ugly errors., (*2)

This new implementation allows you to - if needed - include a last, global error handler before displaying error messages. The errorAction is called and, if it can't handle the issue, we take the stage and decide what to do with the error - if you're debugging the application we will give you a really, really nice error page that will help you finding what's wrong :), (*3)

Usage

  1. Install it:, (*4)

    • Using Composer (it will automatically install Whoops main libraries as well):
    composer require igorsantos07/yii-whoops:1
    composer install
    
    • Or downloading and unpacking it in your extensions folder.
  2. If you're using Composer, I strongly recomend you to create a vendor alias if you haven't yet. Add this to the beginning of your config/main.php:, (*5)

    Yii::setPathOfAlias('vendor', __DIR__.'/../../vendor');
    
  3. Replace your errorHandler entry at config/main.php with the error handler class. Example:, (*6)

    'errorHandler' => ['class' => 'vendor.igorsantos07.yii-whoops.WhoopsErrorHandler']
    
  4. If you're using some custom LogRoute that binds to the application's end, you can disable it using the component's disabledLogRoutes property. Just set it to an array containing all the classnames (not aliases!) of each route you want disabled whenever Whoops is launched. By default it disables the famous (Yii Debug Toolbar)ydtb; if you want to keep it enabled, override the defaultDisabledLogRoutes property., (*7)

    'errorHandler' => [
       'class'             => 'vendor.igorsantos07.yii-whoops.WhoopsErrorHandler',
       'disabledLogRoutes' => 'MyCustomRouteClass'
    ]
    
  5. There were some changes in the API for further error action handling. If you want to have custom error pages you can as usual include a errorAction property into the errorHandler above, but with the following differences:, (*8)

  • Yii::app()->errorHandler->error now can be a CEvent in case of PHP errors or a normal Exception in case of, uh, exceptions. Have that in mind when handling errors in your action, as PHP Errors have no code and etc - however, if you're showing an error page is advised to use the standard 500 code.
  • If your action is unable to handle the error, Whoops will still get to the stage as usual. Example: all API errors in your app will show a small message and redirect the user, while other errors are real problems and should be handled by the framework's error handler. To tell WhoopsErrorHandler you've taken care of the issue, call Yii::app()->errorHandler->handled(), and then Whoops will not interfere with what the action has done; if after the action he still thinks he should do something, the Whoops error page will be called as usual.

Sample screenshot

, (*9)

The Versions

30/09 2014

dev-master

9999999-dev

Whoops integration class into Yii Framework 1.1

  Sources   Download

BSD-3-Clause

The Requires

 

exception yii error handler handling trace whoops error-handler error-handling stack-trace

30/09 2014

v1.3.1

1.3.1.0

Whoops integration class into Yii Framework 1.1

  Sources   Download

BSD-3-Clause

The Requires

 

exception yii error handler handling trace whoops error-handler error-handling stack-trace

30/05 2014

v1.3.0

1.3.0.0

Whoops integration class into Yii Framework 1.1

  Sources   Download

MIT

The Requires

 

The Development Requires

30/05 2014

v1.2.2

1.2.2.0

Whoops integration class into Yii Framework 1.1

  Sources   Download

MIT

The Requires

 

The Development Requires

30/05 2014

v1.2.1

1.2.1.0

Whoops integration class into Yii Framework 1.1

  Sources   Download

MIT

The Requires

 

The Development Requires

29/05 2014

v1.2.0

1.2.0.0

Whoops integration class into Yii Framework 1.1

  Sources   Download

MIT

The Requires

 

The Development Requires

16/05 2014

v1.1.0

1.1.0.0

Whoops integration class into Yii Framework 1.1

  Sources   Download

MIT

The Requires

 

The Development Requires

12/05 2014

1.0.0

1.0.0.0

Whoops integration class into Yii Framework 1.1

  Sources   Download

MIT

The Requires

 

The Development Requires