Because it is a library that is widely used and constantly updated, I recommend PHPOffice / PhpSpreadsheet . Here I leave a basic script from its installation until the opening of an excel file.
For installation, just the following command:
composer require phpoffice/phpspreadsheet
This will create the vendor
folder with the following structure
vendor
|
├─ composer
|
└─ phpoffice
|
└─ phpspreadsheet
Once the library is installed you can open a file in Xlsx format in the following way
<?php
require 'vendor/autoload.php';
$filename = "mi_archivo.xlsx";
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx");
$spreadsheet = $reader->load($filename);
try {
} catch (\Exception $e) {
echo 'Ocurrio un error al intentar abrir el archivo ' . $e;
}
There are a number of examples that you can review here I hope this gives you a light for resolve