I am trying to create an excel file by invoking a class. This is a class that I have written and inside this class, I am trying to invoke the PHPOFFICE library that is already installed on my system. My code is as follows:
class createXls {
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
public function createXl($loginid, $report_index, $header, $data, $fname)
{
But I am unable to get this to work because clearly require
cannot be placed outside the method. How do I go about doing this?