We are actually migrating our PHP project from PHP 5.3 to 7.2.
I recently migrate many libraries to Composer.
I have a problem to replace PHPExcel
with PhpSpreadSheet
which doesn't support PHP 5.3.
I keep PHPExcel
in a separate folder for the moment and I use PHP_VERSION_ID
to use either one or the other.
// early in the file to use another dependency
require_once 'vendor/autoload.php';
.
.
.
if (PHP_VERSION_ID > 50400) {
$workbook = new PhpOffice\PhpSpreadsheet\Spreadsheet();
} else {
require_once 'lib/PHPExcel/Classes/PHPExcel.php';
$workbook = new PHPExcel();
}
For the moment, our code must keep running under PHP 5.3 and 7.2.
Is there a solution to tell Composer autoloader to not autoload PhpSpreadSheet
under PHP 5.3?