title: How to integrate PHPExcel in Yii2 Framework?
body: <p>I want to capture html form fields data and save it in a .xlsx file. I looked around and found PHPExcel but couldn't figure out how to integrate it to Yii2. Can someone tell me how to integerate. I want to use something like this in my controller:</p>
  
  <pre><code>require('../PHPExcel.php');
  $objPHPExcel = new PHPExcel;
  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel,  "Excel2007");
  header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  header('Content-Disposition: attachment;filename="file.xlsx"');
  header('Cache-Control: max-age=0');
  $objWriter-&gt;save('php://output');`
  </code></pre>