From f4141247e058f0f09d4349c02a8fed3708757c10 Mon Sep 17 00:00:00 2001 From: llupa <41073314+llupa@users.noreply.github.com> Date: Fri, 30 Oct 2020 20:47:47 +0100 Subject: [PATCH] Move dracoblue/naith as dev; Switch to phpoffice/phpspreadsheet (#40), update php req * Move dracoblue/naith as dev * Switch to phpoffice/phpspreadsheet; * Update PHP req --- .travis.yml | 9 ++------- README.md | 4 ++++ composer.json | 8 +++++--- src/Craur.php | 7 +++++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 00ab923..f7d000d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,9 @@ language: php matrix: include: - - php: 5.3 - dist: precise - - php: 5.4 - - php: 5.5 - - php: 5.6 - - php: 7.0 - - php: 7.1 - php: 7.2 + - php: 7.3 + - php: 7.4 before_script: "make install-dependencies" script: "make test && cat junit.xml" diff --git a/README.md b/README.md index 0449347..b4eb404 100644 --- a/README.md +++ b/README.md @@ -410,6 +410,10 @@ element, you can do this: ## Changelog +- 3.0.0 (2020/10/22) + - moved `dracoblue/naith` as a dev dependency + - dropped `phpoffice/phpexcel` for `phpoffice/phpspreadsheet` instead + - dropped support for `PHP 5`, `PHP 7.0` and `PHP 7.1` - 2.1.1 (2017/12/12) - added compatibility to symfony/yaml 4.x - 2.1.0 (2017/03/13) diff --git a/composer.json b/composer.json index 51ad3b3..58f2912 100644 --- a/composer.json +++ b/composer.json @@ -10,11 +10,13 @@ } ], "require": { - "php": ">=5.3.0", - "dracoblue/naith": "^1.1", - "phpoffice/phpexcel": "^1.7", + "php": "^7.2", + "phpoffice/phpspreadsheet": "^1.12", "symfony/yaml": "^2.0 || ^3.0 || ^4.0" }, + "require-dev": { + "dracoblue/naith": "^1.1" + }, "autoload": { "classmap": [ "src/" ] }, diff --git a/src/Craur.php b/src/Craur.php index 9420b25..12f3c9b 100644 --- a/src/Craur.php +++ b/src/Craur.php @@ -292,7 +292,9 @@ static function createFromCsvFile($file_path, array $field_mappings) * assert(in_array($author->get('name'), array('Hans', 'Paul', 'Erwin'))); * } * } - * + * + * @throws \PhpOffice\PhpSpreadsheet\Exception + * * @return Craur */ static function createFromExcelFile($file_path, array $field_mappings) @@ -310,7 +312,8 @@ static function createFromExcelFile($file_path, array $field_mappings) $entries = array(); - $excel_object = PHPExcel_IOFactory::load($file_path); + $excel_type = \PhpOffice\PhpSpreadsheet\IOFactory::identify($file_path); + $excel_object = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($excel_type)->load($file_path); $rows = $excel_object->getActiveSheet()->toArray(null,true,true,true);