title: Slim 3 Save Request & Response In Database
body: <p>I have created a middleware in Slim 3 which saves the request into the database.But i am having difficulty in saving the response. I am not getting the response in the middleware after the app runs. Please check the below code</p>
  
  <pre><code>$this-&gt;logId = $apiLogController-&gt;saveLog($parsedBody, $headers, $queryParams, $ipAddress, $url);
      //call the app
      $response-&gt;getBody()-&gt;write('BEFORE');
      $response = $next($request, $response);
      $response-&gt;getBody()-&gt;write('AFTER');
      echo '&lt;pre&gt;';
      var_dump($response-&gt;getBody()-&gt;getContents());exit;
  </code></pre>
  
  <p>I am also using other middlewares in the app. How can i get the response in the middleware so that i can save that in database.</p>