Version 2 Upgrade Guide
Upgrade the main package to v2 with native XLS, improved package boundaries, and developer-facing maintenance APIs through v2.0.5.
Updated
What you will learn
- Understand the breaking API and implementation changes in v2.
- Keep the main package on the supported 2.x release line.
- Validate the complete main distribution before publishing tags.
Understand the v2 architecture changes#
| Change | v2 behavior |
|---|---|
| Common release family | All split repositories are tagged v2.0.0 and internal Composer requirements use ^2.0. |
| Legacy XLS | mnb/mnb-phpexcel is a fully native BIFF8/OLE reader and writer with no PhpSpreadsheet dependency or fallback. |
| Generic Database | mnb/mnb-phpexcel depends only on Core and PDO; it does not install XLSX. |
| Large XLSX imports | The new mnb/mnb-phpexcel package owns direct large-XLSX-to-PDO orchestration. |
| Core boundaries | Core uses capability interfaces and actionable optional-package errors instead of importing concrete format classes. |
| XLSX boundaries | Import-template generation and compatibility fixtures are package-local and do not require Application. |
Install the main distribution#
composer require mnb/mnb-phpexcel:^2.0Update the Composer requirement#
{
"require": {
"mnb/mnb-phpexcel": "^2.0"
}
}Run composer update mnb/mnb-phpexcel -W to refresh the lock file and installed code after publishing a patch release.
Remove old compatibility assumptions#
- Remove direct use of
Compatibility\XlsReaderandCompatibility\XlsWriter; useReader\XlsReader,Writer\XlsWriter, orFormat\Xls. - Remove
phpoffice/phpspreadsheetwhen no unrelated dependency requires it. - Use
MnbExcelfor normal reads and writes. SpecializedFormat\XlsxAPIs are included in the same main package. LargeExcelDatabaseImportEngineis included in the main package.- Treat ODS as a reader-only module.
Apply the v2.0.1 through v2.0.5 Core maintenance updates#
| Release | Developer-facing change |
|---|---|
v2.0.1 | Native XMLReader initialization no longer reads libxml-backed properties before the first node. |
v2.0.2 | Worksheet selection throws actionable SheetSelectionException errors with stable codes and caller context. |
v2.0.3 | Added active-sheet discovery, optional sheet selection, normalized empty checks, and assertHasRows(). |
v2.0.4 | Added the opt-in MnbExcelErrorHandler for clean developer text, HTML, or JSON rendering. |
v2.0.5 | Structured sheet/workbook summaries distinguish total, source, explicit/implicit empty, skipped, header, and returned row counts. |
Projects using ^2.0 accept these compatible Core patch releases. Existing published tags are immutable; publish fixes under new patch tags rather than moving v2.0.0.
Publish the main package release#
1. Merge tested changes into main.
2. Run Composer validation and the full test suite.
3. Create an immutable patch tag such as v2.0.5.
4. Push main and the tag.
5. Refresh Packagist and verify the installed dist archive.
6. Deploy the matching documentation site.Use Git tags as Composer versions; do not add a manual version field to the library Composer file.
Verify before release#
- Run
composer validate --strictin the main repository. - Run the main package syntax, smoke, integration, and release checks.
- Run full facade and format interconnectivity tests.
- Confirm
composer why phpoffice/phpspreadsheetreports no MNB dependency. - Open representative native XLS and XLSX output in Microsoft Excel desktop and LibreOffice.
- Test against every supported PDO driver with real transactions and duplicate constraints.
- Validate the documentation site, clean links, code snippets, sitemap, and production routing.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue