title: laravel5.3 generate download (.txt) on the fly
body: <p>What's the best way to generate a download (in my case of a .txt file) on the fly? By this I mean without storing the file on the server before. For understanding here's what I need to get done:</p>
  
  <pre><code>public function getDesktopDownload(Request $request){
  
          $txt = "Logs ";
  
          //offer the content of txt as a download (logs.txt)
          $headers = ['Content-type' =&gt; 'text/plain', 'Content-Disposition' =&gt; sprintf('attachment; filename="test.txt"'), 'Content-Length' =&gt; sizeof($txt)];
  
          return Response::make($txt, 200, $headers);
  }
  </code></pre>