whipsterCZ / laravel-tracy

Tracy Debugger support for Laravel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tracy Debugger support for Laravel

This service provider adds the powerful Tracy debug tool to the Laravel 5 framework.

Nette Tracy screenshot

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.

Requirements

  • Tracy =2.3.7
  • Laravel >5.1 = Choose repository tag matching your laravel version

Installation

  1. Add Tracy to your composer.json
"require": {
    "tracy/tracy": "2.3.7"
}
  1. Add source code to your existing App - directories should match service Namespace
app/Services/Tracy/
  1. register service provider in your config/app.php
'providers' => [
	...,
	App\Services\Tracy\ServiceProvider::class,
]

Configuration

This is it! No configuration needed. If you need configure Tracy or Laravel Exception handler @see Tracy/ServiceProvider.php

Bugsnag integration

Tracy service automatically utilize Bugsnag error handling if bugsnag-laravel package is present

Logging

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/

TroubleShooting

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..

About

Tracy Debugger support for Laravel

License:GNU General Public License v2.0


Languages

Language:PHP 100.0%