how to add PHPExcel library in laravel?

断了今生、忘了曾经 提交于 2019-12-04 07:17:25

You can use the PHPExcel Composer package. Just add "phpoffice/phpexcel": "dev-master" to your composer.json and enter composer update. This way the library will be "installed" and you can use it as normal (for example $objPHPExcel = new PHPExcel();) No need for manual includes etc.

Update may 2016

Instead of editing your composer.json, please use the 'official' command:

composer require phpoffice/phpexcel

Below are the step to use PHPEXCEL Library with laravel 5

1:- Install "phpoffice" Package in Laravel 5. Below is the link for the packages

2:- Add "phpexcel/phpexcel": "dev-master" to your composer.json. Ex:- "require": { "phpexcel/phpexcel": "dev-master" }

3:- Then execute "composer update".

4:- Open the file "/vendor/composer/autoload_namespaces.php". Paste the below line in the file.

// Include PHPEXCEL Library with Laravel 5
'PHPExcel' => array($vendorDir . '/phpoffice/phpexcel/Classes'),

5:- Now you can use PHPEXCEL library in your controllers or middleware or library. use PHPExcel; use PHPExcel_IOFactory;

For more details you can access "https://github.com/pantlavanya/export-to-excel-using-phpoffice-phpexcel-in-laravel-5" link.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!