- PHP: ^7.2|^8.0
- Laravel: ^5.8
- PhpSpreadsheet: ^1.21
- PHP extensions:
- zip
- xml
- gd2
- iconv
- simplexml
- xmlreader
- zlib
Ensure the required PHP extensions are installed and enabled. Uncomment the necessary extensions in your php.ini
file. For example, uncomment ;extension=gd
by removing the ;
.
Run the following command to install the necessary extensions on an Ubuntu-based system:
sudo apt install php-zip php-xml php8.1-gd php8.1-iconv php8.1-simplexml php8.1-xmlreader php-zip
Installation generally follows: php-[package_name]
or php[php_version_number]-[package_name]
Refer to the official PHP documentation for instructions on installing extensions on a Windows machine.
- Require the necessary packages:
composer require phpoffice/phpspreadsheet
composer require psr/simple-cache ^2.0
composer require maatwebsite/excel:^3.1
composer update
- The Excel facade should be auto detected. If not, manually add it to
app.php
in theconfig
folder:
providers' => [
/*
* Package Service Providers...
*/
Maatwebsite\Excel\ExcelServiceProvider::class,
]
'aliases' => [
...
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
]
For instructions on how to set up Laravel consult this readme. For more details, visit the official PHP documentation.