This service provider adds the powerful Tracy debug tool to the Laravel 5 framework.
Why is Tracy better than the laravel (Symfony) build-in debugger?
- Exception stack trace contains values of all method arguments.
- Request & Response & Server environment information is displayed on the error page.
- The whole error page with full stack trace can be easily stored to some directory as HTML file (useful on production mode).
- Webmaster can be notified by email about errors that occured on the site.
See full Tracy docs and sample error page.
Tracy is a part of the Nette Framework.
- Tracy =2.3.7
- Laravel >5.1 = Choose repository tag matching your laravel version
- Add Tracy to your composer.json
"require": {
"tracy/tracy": "2.3.7"
}
- Add source code to your existing App - directories should match service Namespace
app/Services/Tracy/
- register service provider in your config/app.php
'providers' => [
...,
App\Services\Tracy\ServiceProvider::class,
]
This is it! No configuration needed.
If you need configure Tracy or Laravel Exception handler @see Tracy/ServiceProvider.php
Tracy service automatically utilize Bugsnag error handling if bugsnag-laravel
package is present
Service recognize application environment using env('APP_DEBUG')
If APP_DEBUG is false
or Request()->ajax() is true
service log your Exceptions to directory
/storage/logs/
If you are sending JSON with TracyDebugBar rendered, you have probably created JSON Response wrong way.
Route::get('json',function(){
$user = \App\Models\User::first();
return $user; //Correct ->toJson() will be invoked and JSON Response will be created
$json = $user->toJson();
return $json; //Wrong - it creates Text/Plain Response
return \Response::json($json); //This is OK, but note that your JSON will be ESCAPED
});
Use Tracy version 2.3.7 some newer versions are incompatible..