diff --git a/README.md b/README.md index 0b01163..fcada1b 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,13 @@ composer require anourvalar/office ### Phpspreadsheet is required to work with Excel (xlsx). ```bash -composer require phpoffice/phpspreadsheet "^1.28" +composer require phpoffice/phpspreadsheet "^1.29" ``` ### Zipstream-php is required to work with Word (docx). ```bash -composer require maennchen/zipstream-php "^2.4" +composer require maennchen/zipstream-php "^3.1" ``` ### Mpdf is required to work with PDF. diff --git a/phpstan.neon b/phpstan.neon index 8adfc22..0e71f4b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -28,7 +28,6 @@ parameters: - '#Binary operation \"\-\" between string and string results in an error#' - '#Instantiated class PhpOffice#' - '#expects string, int given#' - - '#expects int, string given#' - '#has invalid type PhpOffice#' - '#Match expression does not handle remaining value: mixed#' - '#Access to an undefined property AnourValar\\Office\\Drivers\\MixInterface\:\:\$spreadsheet#' diff --git a/src/Drivers/ZipDriver.php b/src/Drivers/ZipDriver.php index 4e669eb..ed7d8da 100644 --- a/src/Drivers/ZipDriver.php +++ b/src/Drivers/ZipDriver.php @@ -77,7 +77,11 @@ public function save(string $file, \AnourValar\Office\Format $format): void throw new \LogicException('Driver only supports saving in the same format.'); } - $zipStream = new \ZipStream\ZipStream(); + if (class_exists(\ZipStream\Option\Archive::class)) { + $zipStream = new \ZipStream\ZipStream(); // 2.x + } else { + $zipStream = new \ZipStream\ZipStream(sendHttpHeaders: false, defaultEnableZeroHeader: false); // 3.x + } ob_start(); try {