title: how to zip folder in laravel 5?
body: <p>need some help for laravel zip file. i have a folder in the public folder and i would like to create a zip of that folder (temp_file folder) whenever the user clicks the button.</p>
  
  <pre><code>public function testing()
  {
      $public_dir = public_path('temp_file/');
      $zipFileName = 'myZip.zip';
      $zip = new ZipArchive;
  
      if ($zip-&gt;open($public_dir . '/' . $zipFileName, ZipArchive::CREATE) === TRUE) {
          $zip-&gt;addFile('file_path', 'file_name');
          $zip-&gt;close();
      }
  
      $headers = array('Content-Type' =&gt; 'application/octet-stream');
  
      $filetopath = $public_dir . '/' . $zipFileName; 
  }
  </code></pre>
  
  <p>but it seems that it is not creating the zip file and i can't download it. Please need some help</p>