1. Go to this page and download the library: Download dcat-x/easy-excel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Dcat\EasyExcel\Excel;
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter;
// 保存到本地路径
Excel::export($data)->store('/tmp/users.xlsx');
// 使用 Flysystem
$filesystem = new Filesystem(new LocalFilesystemAdapter(__DIR__));
Excel::export($data)->disk($filesystem)->store('users.xlsx');