barbushin / php-console

Handle PHP errors, dump variables, execute PHP code remotely in Google Chrome
https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef
MIT License
1.34k stars 283 forks source link

Slim Framework adapter #86

Closed ffflabs closed 9 years ago

ffflabs commented 9 years ago

Hi @barbushin

I've made a PHP Console adapter for Slim Framework.

I was using Slim, then Slim-Monolog, then Monolog just to instantiate Monolog's PHPConsoleHandler to debug to PHPConsole.

It was cumbersome so I decided to remove the middle men and log directly to PHPConsole.

    $logwriter = new \Amenadiel\SlimPHPConsole\PHPConsoleWriter(true);
    $app = new \Slim\Slim(array(
        'log.enabled' => true,
        'log.level' => \Slim\Log::DEBUG,
        'log.writer' => $logwriter
    ));

    $app->log->debug('Debug called!');

it can be installed with composer:

composer require amenadiel/slim-phpconsole

I hope it might be useful to someone.

barbushin commented 9 years ago

Thanks, Felipe! I've added link to your adapter in README.md https://github.com/barbushin/php-console/blob/master/README.md#slim-framework

:+1: