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 = 1/0;
        echo "<data>response sum=$sum</data>";
    });

$application->run();

?>

The following video clip overviews this code sample, shows its execution and provides a detailed explanation for each and every part of it.

You can find more video clips, code samples and training material for learning the Slim framework in my online free courses website at http://abelski.lifemichael.com.

Leave a Reply

Your email address will not be published. Required fields are marked *