Developed with love by KnpLabs Hire us for your project!
0

tracy-bundle

by kutny

Tracy PHP debugger bundle for Symfony framework

Tracy PHP debugger bundle for Symfony

This bundle adds the powerful Tracy debug tool to the Symfony2 framework.

Nette Tracy screenshot

Why is Tracy better than the 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.

Installation

1) Install via composer:

composer require kutny/tracy-bundle

2) Add KutnyTracyBundle to your application kernel.
For This bundle to catch as many errors as possible it should be the first bundle in the bundles array.

// app/AppKernel.php
public function registerBundles()
{
    return array(
        new Kutny\TracyBundle\KutnyTracyBundle(),
        // ...
    );
}

Configuration

1) app.php / app_dev.php

Open web/app.php and web/app_dev.php files and add the following code before the AppKernel class is instantiated:

\Tracy\Debugger::enable();

Or force the production mode where only general server error page will be displayed to the user (read more):

\Tracy\Debugger::enable(\Tracy\Debugger::PRODUCTION);

I also recommend you to enable Tracy in a strict mode so it can handle errors of type E_NOTICE and E_WARNING too.

\Tracy\Debugger::$strictMode = true;

2) config.yml

kutny_tracy:
    emails: ['errors@mycompany.com'] # error notification recipients
    exceptions_directory: <directory> # optional, default directory set to %kernel.logs_dir%/exceptions
    store_username_in_server_variable: true|false # optional, default value = false; stores username of logged user in $_SERVER['SYMFONY_USERNAME'] - helps you to find out which user encountered the error
    ignored_exceptions:
        - Symfony\Component\HttpKernel\Exception\BadRequestHttpException
        - RuntimeException
        - UnexpectedValueException


License

This bundle license: https://github.com/kutny/tracy-bundle/blob/master/LICENSE

Tracy debugger license: https://github.com/nette/tracy/blob/master/license.md

Copyright (c) 2013 Jiri Koutny

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
kutny_tracy:
emails: []
exceptions_directory: ~
store_username_in_server_variable: ~
ignored_exceptions: []