/** * pre configuration of csv file */ protected function init() { $this->csvWriter->setDelimiter("\t"); //the delimiter will be the tab character $this->csvWriter->setNewline("\r\n"); //use windows line endings for compatibility with some csv libraries $this->csvWriter->setEncodingFrom("utf-8"); }
/** * Prepare the writer. */ public function prepare() { if (!$this->csv) { $this->csv = Writer::createFromFileObject(new SplFileObject($this->filename, 'w')); $this->csv->setDelimiter($this->delimiter); $this->csv->setEnclosure($this->enclosure); } if ($this->header !== null) { $this->writeItem($this->header); } }