2017 © Pedro Peláez
 

package tracy-redbean

RedBeanPHP queries logger panel for Tracy

image

filisko/tracy-redbean

RedBeanPHP queries logger panel for Tracy

  • Saturday, August 27, 2016
  • by Filisko
  • Repository
  • 1 Watchers
  • 2 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 9 % Grown

The README.md

RedBean queries logger for Tracy

Result

RedBeanPHP queries logger for Tracy, (*1)

Installation and configuration

Install it via composer:, (*2)

composer require filisko/tracy-redbean, (*3)

To make this work you must enable RedBean's debug mode to log your queries. You can simply use RedBean's Facade debug() method., (*4)

How to use

Basic example

To use this logger with any application, you could basically do something like that:, (*5)

R::setup('mysql:host=hostname;dbname=db', 'username', 'password');
/*
Possible log modes:
-------------------
0 Log and write to STDOUT classic style (default)
1 Log only, class style
2 Log and write to STDOUT fancy style
3 Log only, fancy style (it works nicely with this one)
*/
R::debug(true, 3);

// ... your queries here ...

// Get RedBean's Logger
$logger = R::getLogger();

// Create new instance of the panel
$panel = new \Filisko\Tracy\RedBeanBarPanel($logger);

// Boot the panel (collect and show the panel)
\Filisko\Tracy\RedBeanBarPanel::boot($panel);

Middleware example

If you are using some framework that works with PSR-7, you could use the logger like that:, (*6)

// Get RedBean's Logger
$logger = R::getLogger();

// Create new instance of the panel
$panel = new \Filisko\Tracy\RedBeanBarPanel($logger);

// Add to middleware
$app->add(new \Filisko\Tracy\RedBeanBarPanelMiddleware($panel));

Extras

If you realized that RedBean puts at the end of your SQL queries something like '--keep-cache' for internal caching purposes and you want to hide this part from the logger, you could simply use a static flag to disable it:, (*7)

\Filisko\Tracy\RedBeanBarPanel::$showKeepCache = false; // That's all!

If you would like to change the little icon of the panel or the title, use the provided static variables:, (*8)

\Filisko\Tracy\RedBeanBarPanel::$icon = 'src/path/icon.png';
\Filisko\Tracy\RedBeanBarPanel::$title = 'RedBean query logger';

You can have a look to RedBean's website debugging page to understand a little bit better the examples., (*9)

The Versions

27/08 2016

dev-master

9999999-dev

RedBeanPHP queries logger panel for Tracy

  Sources   Download

MIT

The Requires

 

by Avatar Filisko

logger panel tracy redbean

27/08 2016

1.0

1.0.0.0

RedBeanPHP queries logger panel for Tracy

  Sources   Download

MIT

The Requires

 

by Avatar Filisko

logger panel tracy redbean