Laravel-excel: Getting the following error Class 'Maatwebsite\Excel\ExcelServiceProvider' not found

Created on 21 Nov 2014  路  8Comments  路  Source: Maatwebsite/Laravel-Excel

I have gone over many times in the configuration to make sure everything is correct and it is as well as uploaded the files in my vendor folder but still getting the following error

Class 'Maatwebsite\Excel\ExcelServiceProvider' not found

So I am not sure why

Most helpful comment

Make sure you publish after following these steps

  1. add this line to composer.json
    "maatwebsite/excel": "~2.1.0",

then run
composer update

  1. After updating composer, add the ServiceProvider to
    the providers array in app/config/app.php like
    'Maatwebsite\Excel\ExcelServiceProvider',

and alias like so
'Excel' => 'Maatwebsite\Excel\Facades\Excel',

  1. And finally, publish
    php artisan vendor:publish for Laravel 5
    php artisan config:publish maatwebsite/excel for L4

I hope it helps someone.!

All 8 comments

Are you sure you've followed the installation instructions as mentioned here: https://github.com/Maatwebsite/Laravel-Excel#installation correctly?

I gather from your response you didn't use composer? Also adding the lines in the app/config/app.php file is very important.

With L5.2 had the same issue.
Take these steps:

  1. start: add dependency to your app by using command composer require "maatwebsite/excel:~2.1.0"
  2. add alias and class name to config/app.php just like the instruction says

Hope it helps!

No,its not working. It shows me error
Class 'Maatwebsite\Excel\ExcelServiceProvider' not found
I am using laravel-5

Same here... :sob: Tried to install in a new project laravel 5.0 and I get the same error.

Make sure you publish after following these steps

  1. add this line to composer.json
    "maatwebsite/excel": "~2.1.0",

then run
composer update

  1. After updating composer, add the ServiceProvider to
    the providers array in app/config/app.php like
    'Maatwebsite\Excel\ExcelServiceProvider',

and alias like so
'Excel' => 'Maatwebsite\Excel\Facades\Excel',

  1. And finally, publish
    php artisan vendor:publish for Laravel 5
    php artisan config:publish maatwebsite/excel for L4

I hope it helps someone.!

For Laravel 5, because I can't verify every major release of that version, if you see providers array values in config/app.php that ends up with ::class, follow that pattern. So Maatwebsite\Excel\ExcelServiceProvider will be Maatwebsite\Excel\ExcelServiceProvider::class. To recap:

  1. Add to require the "maatwebsite/excel": "~2.1.0".
  2. Run composer update.
  3. Add Maatwebsite\Excel\ExcelServiceProvider::class in the providers array. You may also add
    'Excel' => Maatwebsite\Excel\Facades\Excel::class in your aliases array just below providers array.
  4. Run php artisan vendor:publish. You should see excel.php in the config folder.

Put allias
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
And then in your controller
use Excel

@shadywattay Thanks! you saved me. Thanks a ton...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lucatamtam picture lucatamtam  路  3Comments

contifico picture contifico  路  3Comments

alejandri picture alejandri  路  3Comments

wwendorf picture wwendorf  路  3Comments

octoxan picture octoxan  路  3Comments