進而友善我們以優雅的、富有表現力的代碼實作Excel/CSV檔案的導入和導出。
教學:https://laravelacademy.org/post/2024.html
原文檔:https://laravel-excel.maatwebsite.nl/2.1/getting-started/
教學文檔中安裝因為官方出了3.0系列和2.0不相容是以,LA5.5版本需要安裝2.0系列
使用Composer安裝依賴 指定2.1版本其他按照教學即可
composer require "maatwebsite/excel:~2.1.0"
安裝後的設定
在
config/app.php
中注冊服務提供者到
providers
數組:
Maatwebsite\Excel\ExcelServiceProvider::class,
同樣在
config/app.php
中注冊門面到
aliases
數組:
'Excel' => Maatwebsite\Excel\Facades\Excel::class,