I'm trying to use this library to create excel files but not how to install it. I was considering to download the library from its home page (http://phpexcel.codeplex.com/wikipage?title=Examples) but also do not know what folder should I place it. How I can install?
You should use composer: Add "phpexcel/phpexcel": "dev-master"
to your composer.json
"require": {
"phpexcel/phpexcel": "dev-master"
}
Then execute composer update
. So you can use it as normal:
public function import($path){
$objPHPExcel = PHPExcel_IOFactory::load($path);
$objWorksheet = $objPHPExcel->getActiveSheet();
$highestRow = $objWorksheet->getHighestRow();
for ($row = 1; $row <= $highestRow; ++$row) {
var_dump($objWorksheet->getCellByColumnAndRow(1, $row));
}
}
For install PhpExcel in laravel 5.
Please visit this link for pakage -https://packagist.org/packages/phpoffice/phpexcel.
Please follow the instruction --
1:- Add "phpoffice/phpexcel": "dev-master"
to your composer.json.
2:- execute "composer update"
on terminal.
3:- Open the file "/vendor/composer/autoload_namespaces.php". Paste the below line in the file.
'PHPExcel' => array($vendorDir . '/phpoffice/phpexcel/Classes'),
4:- Now you can use PHPEXCEL library in your controllers or middleware or library.
use PHPExcel;
use PHPExcel_IOFactory;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With