seine / seine
Seine - Write spreadsheets of various formats to a stream
Installs: 65 369
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 3
Open Issues: 2
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-04-13 10:59:56 UTC
README
Write spreadsheets of various formats to a stream
Low memory, high performance library for writing large spreadsheets in various standard formats. Only a small subset of features are included, which means row level styling and right now, no formulas either.
Memory: Everything is written to disk (stream), so memory overhead is pretty much zero. Speed: It's pretty damn fast! However because of the memory constraint, it's not mindblowing.
Stability
This library is ALPHA/BETA quality.
Dependencies
- PHP 5.3
- ZipArchive (only OOXML and you can create your own zip compressor, if you prefer another solution)
Writers
- Office Open XML Spreadsheet (.xlsx)
- Microsoft Excel 2003 XML (.xml)
- CSV (.csv)
Examples
Create a new document and close it after you done.
<?php use Seine\Seine; // writer options are: csv, ooxml2007, oxml2003 $seine = new Seine(array('writer' => 'ooxml2007')); $doc = $seine->newDocument('example.xlsx'); // add rows and styles... $doc->close(); ?>
Create a new document using an existing stream
<?php $fp = fopen('filename.csv', 'w'); $doc = $seine->newDocumentFromStream($fp); $doc->close(); fclose($fp); ?>
Add 100.000 rows with 25 columns in ~25 seconds.
<?php $sheet = $doc->newSheet(); for($i = 0; $i < 100000; $i++) { $sheet->addRow(range(0, 25)); } ?>
Add styling to a row.
<?php $style = $doc->newStyle() ->setFontBold(true) ->setFontFamily('Aria') ->setFontSize('14'); $row = $seine->getRow(array('cell1', 'cell2')); $row->addStyle($style); ?>