Debugging in Slim Framework PRO

The Slim framework allows us to enable a debugging mode. Once doing it, each time an exception is thrown the Slim framework will generate a detailed debugging message. The following code sample shows how to do it. <?php namespace Com\LifeMichael\Samples; require ‘Slim/Slim.php’; \Slim\Slim::registerAutoloader(); $application = new \Slim\Slim(array(‘debug’ => false)); $application->get( ‘/dbg’, function () { $temp […]

Logging Messages in Slim Framework PRO

The Slim Framework provides us with the Log object. Writing logging messages involves with calling various functions on that object. <?php namespace Com\LifeMichael\Samples; require ‘Slim/Slim.php’; \Slim\Slim::registerAutoloader(); $application = new \Slim\Slim(); $logger = $application->log; $logger->setEnabled(true); $logger->setLevel(\Slim\Log::DEBUG); $environment = \Slim\Environment::getInstance(); $application->get( ‘/simplelogs’, function () { GLOBAL $logger; $logger->info(“i m now starting the get handling function”); echo “<data>response</data>”; […]

Skip to content Update cookies preferences