title: Log PHP exceptions and Errors to Database table PHP Slim 3
body: <p>So I am trying to find the best way to get PHP SLIM 3 to log PHP exceptions and errors to a Database table instead of a log.  whats the best way to accomplish this?  So far in the documentation recommends this.</p>
  
  <p>Dependency:</p>
  
  <pre><code>$app = new \Slim\App();
  $c = $app-&gt;getContainer();
  $c['errorHandler'] = function ($c) {
      return function ($request, $response, $exception) use ($c) {
          return $response-&gt;withStatus(500)
              -&gt;withHeader('Content-Type', 'text/html')
              -&gt;write('Something went wrong!');
      };
  };
  </code></pre>
  
  <p>What I am having trouble understanding is where do I call this and how could I connect this to log it into a database table that I created.   Any Ideas?  </p>