Standalone CSV + TSV package
PHP CSV & TSV Library for Streaming, Encoding & Safe Exports
Use the standalone MNB PHPExcel CSV package for low-memory CSV and TSV pipelines that need delimiter detection, encoding conversion, column projection, strict input limits, or spreadsheet-safe exports.
Composer
composer require mnb/mnb-phpexcel-csv:^2.0- Package
mnb/mnb-phpexcel-csv- Entry API
Mnb\PHPExcel\Format\Csv- Runtime
- PHP 8.1+
- Format
- .csv / .tsv · delimited text
Choose your CSV workflow#
01
Stream CSV or TSV rowsDetect delimiters and encodings, normalize headers, project columns, and process large delimited files row by row.
Reading guide →02Write spreadsheet-friendly exportsControl headers, delimiters, line endings, quoting, encodings, and CSV-injection safeguards.
Writing guide →03Handle dialects and legacy encodingsWork with Excel, tab, semicolon, pipe, Unix, or custom dialects and convert source encodings into a stable target encoding.
Dialects & encoding →04Review package capabilitiesCheck streaming, validation, limits, output safety, and package-specific behavior before integration.
Feature matrix →Use the right CSV API#
| Task | Primary API | Choose it when |
|---|---|---|
| Read normalized rows | Csv::read() | You need headers, projection, validation, delimiter/encoding options, or forward-only row iteration. |
| Write delimited output | Csv::write() | You need CSV or TSV output with explicit dialect, encoding, header, and injection policies. |
| Detect a delimiter | CsvDialect::detectDelimiter() | The source delimiter is unknown and should be inferred from a representative sample. |
| Detect source encoding | EncodingDetector::detectFile() | Uploads may arrive in UTF-8, Windows-1252, ISO-8859 variants, or another supported encoding. |
What the standalone CSV package covers#
Low-memory delimited input
- CSV and TSV streaming row iteration
- Header normalization and column projection
- Delimiter and encoding detection
- Row, column and file-size limits for uploads
Controlled text exports
- Excel, tab, semicolon, pipe and custom dialects
- UTF-8 and configurable target encodings
- Headers, quoting and line-ending controls
- CSV formula-injection escape policies
One logical sheet by design
- Delimited files expose a single logical sheet
- Fields remain text until your application converts them
- No workbook styles, formulas or embedded media model
- Choose XLSX when workbook presentation matters
Package boundary: this guide uses Mnb\PHPExcel\Format\Csv from mnb/mnb-phpexcel-csv. Install the focused CSV library or the monolithic mnb/mnb-phpexcel package for a project, not both.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue