Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jayandholariya's avatar

Error : Class "Maatwebsite\Excel\Facades\Excel" not found While using Export User data using maatwebsite/excel

I have created fresh laravel 11 application and i have users table and want to export data of users. I have installed package

composer require maatwebsite/excel

So when try to create export using command

php artisan make:command UserExport

getting error :

   ERROR  Command "make:export" is not defined. Did you mean one of these?

So how to export Excel in laravel 11.

php verison is 8.2.12

Laravel Version 11.31

Maatwebsite version 4.1.1

0 likes
1 reply
EveAT's avatar

After you required the package clear the cache (laravel and composer):

First:

composer require maatwebsite/excel

Then:

php artisan config:clear
php artisan cache:clear
composer dump-autoload

Now you can run:

php artisan make:class UserExport

This will create the UserExport class inside the /app

Please or to participate in this conversation.