lightshire / laravel-phpexcel-wrapper
此包的最新版本(dev-master)没有提供许可证信息。
PHPOffice PHPExcel 封装器
dev-master
2014-03-13 20:11 UTC
Requires
- php: >=5.3.0
- illuminate/support: 4.x
- phpoffice/phpexcel: 1.8.0
This package is not auto-updated.
Last update: 2024-09-28 14:57:45 UTC
README
安装
-
通过 composer.json 需求此包
lightshire/laravel-phpexcel-wrapper
-
运行 composer update
$ composer update
-
打开 app/config/app.php 并将 ServiceProvider 添加到 'providers' 数组中
'Lightshire\PHPExcel\ServiceProvider',
-
可选地添加到别名
'Excel' => 'Lightshire\PHPExcel\Facade',
使用方法
从数组创建 Excel xls 文件
Excel::fromArray( array(
array('1', '2', '3'),
array('X', 'Y', 'Z')
) )->save( base_path() . '/sample.xls' );
从数组创建 Excel xlsx 文件
Excel::fromArray( array(
array('Hello', 'World', '!!!'),
array('X', 'Y', 'Z')
) )->save( base_path() . '/sample.xlsx' );
从 Excel 文件创建数组
Excel::excel2Array( base_path() . '/sample.xls' );