Support the ongoing development of Laravel.io →
posted 10 years ago
Packages

In Laravel 4 I could easily install PhpExcel by putting "phpoffice/phpexcel": "dev-master" in composer.json and then do 'composer install' in terminal. It would work perfectly then.

In Laravel 5 however I keep getting "Class 'App\Http\Controllers\PHPExcel' not found". I tried some things with namespaces but to no avail:

I tried using "<?php namespace App\Vendor\Phpoffice\Phpexcel\Classes;" to PHPExcel.php and "use App\Vendor\Phpoffice\Phpexcel\Classes;" in my controller. This didn't work.

I have to admit that I don't quite understand this namespacing stuff in the first place so I don't really feel like I don't know what I'm doing :).

Any pointers? Thanks!

Last updated 3 years ago.
0

I use https://github.com/Maatwebsite/Laravel-Excel easily enough. IN my composer file it reads

"require": {
	"maatwebsite/excel": "~2.0.0",
},

and referenced as

\Excel

Good luck.

0

Add this namespace and it should work if the package has been installed: <code> use PHPExcel_IOFactory; </code>

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Janneman84 janneman84 Joined 27 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.