Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Damnit for Laravel 3
* Thanks to @philsturgeon for pointing this package
* and Filipe Dobreira "" for creating it ^^
* Github :
* How to:
* Step 1 : Setup composer for Laravel 3
* Step 2 : Add this code to your application/start.php or anywhere u like
* as long its after laravel registers its own error handlers
* so NOT in : index.php, paths.php or laravel/**
* Use IoC to setup your whoops instance as singleton and then you can add special
* handlers specific for your needs anywhere
* inside your app code (controller, models, etc...) freaking awesome.
* Ex:
* $damnit = IoC::resolve('whoops');
* $damnit->pushHandler($some-handler-you-made-check-the-whoops-repo-for-examples);
* You can also add datatables for a handler like this
* $damnit = IoC::resolve('whoops');
* $handlers = $damnit->getHandlers();
* $handlers[0]->addDataTable('Ice-cream I like', array(
* 'Chocolate' => 'yes',
* 'Coffee & chocolate' => 'a lot',
* 'Strawberry & chocolate' => 'it\'s alright',
* 'Vanilla' => 'ew'
* )
* );
* Also check out the second handler im not gonna explain it but its also pretty cool.
* Custom error handling with whoops
if (!IoC::registered('whoops')) {
IoC::singleton('whoops', function ($from = true) {
$run = new Whoops\Run;
$handler = new Whoops\Handler\PrettyPageHandler;
// Example: tag all frames with a comment
// Hint: Frames are the code preview for each stack row
$run->pushHandler(function ($exception, $inspector, $run) {
$frames = $inspector->getFrames();
foreach ($frames as $i => $frame) {
$frame->addComment('This is frame number ' . $i, 'example');
if ($function = $frame->getFunction()) {
$frame->addComment("This frame is within function '$function'", 'cpt-obvious');
return $run;
if (Config::get('error.detail')){
$damnit = IoC::resolve('whoops');

This comment has been minimized.

Copy link

@kapooostin kapooostin commented May 1, 2013

In L3 Whoops fails to display the errors in views with a message:

file_get_contents(..\laravel\view.php(386) : eval()'d code): failed to open stream: No such file or directory

Have you encountered anything similar?


This comment has been minimized.

Copy link
Owner Author

@hugomrdias hugomrdias commented Jun 11, 2013

yeah @kapooostin whoops does not handle views errors but it shouldn't give that output either..
its a blade thing and the way it uses eval and cache to build the view but it should output a standard php error.

do you have L3 latest version ? taylor improved the blade's error handling before changing development completely to L4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment