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

Seif5's avatar

Class not found exception

C:\wamp\www\lara>php artisan migrate:reset {"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","me ssage":"Class 'CreateTablePlayer' not found","file":"C:\wamp\www\lara\vendor \laravel\framework\src\Illuminate\Database\Migrations\Migrator.php","line ":301}}

how i fix that ?

0 likes
21 replies
RomainLanz's avatar

Did you create your file with the command line or with another way?

Seif5's avatar

yes with the command line >php artisan migrate:make create_x_table

RomainLanz's avatar

Your error is for migration, why are you talking about controller?

pmall's avatar

Seems like you misnamed your migration class or something. Show some code.

yazeed's avatar

I think you also need to rename one of the migration files if any still has a mention of a no longer existing class name. I've often had to manually clear the database to fix this.

avescasio's avatar

That problem also happens to me in 5.1 version, when trying to run migrate:refresh since I updated my tables: just following the tutorials on how to update for best practice. However I got this problem hereunder:

C:\Program Files\Wamp\www\crud>php artisan migrate:refresh --seed

[Symfony\Component\Debug\Exception\FatalErrorException] Class 'UsersInfos' not found

In the first place I've tried to troubleshoot in my own ways by going to my Users_info.php and tried to edit the "class Users_info extends Model" to "class Users_infos extends Model" and run the migration command again, still nothing happens. so I reverted by my .php file tried to search here and found this post by trying the first comment of RomainLanz but it work for me.

I'm just newbee here and started to use laravel 5.1 for my upcoming projects, I suggested this framework to my team also since I team lead them and they started learning this month February 2016.

Back to problem: what might be the possible cause of that error since I don't remember anything I've done wrong just to prevent messing with our real project.

tptompkins's avatar

I'm having the same issue. In my case, I originally installed Laravel 5.0 and upgraded to 5.2 and after the upgrade is when I started experiencing this error when trying to run php artisan migrate:rollback or php artisan migrate:reset.

Does anyone know why this would be? My migration files / classes are there so I'm not sure why it's saying class not found.

tptompkins's avatar

I fixed this issue by requiring doctrine/dbal:

composer require doctrine/dbal

I'm not really sure why that fixed the issue. But it did. Can anyone explain why? (I thought that doctrine/dbal was only required if using SQLite but I'm using MySQL)

2 likes
wiklander's avatar

@tptompkins I had the same problem and your tip fixed my issue as well. I noticed that "php artisan optimize" was run in the end, perhaps that or the autoload fixed the 'class not found' problem? I tried removing doctrine/dbal and migrating up and down still works for me now.

1 like
okao's avatar

you have to delete the migration table in the database or all the tables if necessary and then you can either run php artisan migrate:refresh... will work perfectly :)

jcgivens21's avatar

@okao : ....you just screwed me. I ran your command to try to fix my situation, and all my stuff rolled back. This has set me back tremendously. TO OTHERS WHO MAY TRY THIS: Please be careful when using php artisan migrate:refresh, as there may be severe consequences.

Virat's avatar

@ RomainLanz thank you it's working fine, plz tell me how it is working

critical-byte's avatar

if composer dump-autoload doesn't work, its probably because you have deleted some migration files, and when you try the php artisan migrate:reset command, it will look for the migration files you have deleted, and can find it, that's because in database laravel stores meta information about the migration files,

to solve this problem delete the migrations table from database, and then run the php artisan migrate:refresh but be warned that this will remove your previous data. if you have any important data first back it up. and then run the command

okao's avatar

@jcgivens21 you didnt mention that you will be needing the data that you have.. and its a must that you have to have backup of your data when you do such tasks. can you suggest any other solution. I didnt provide the answer to screw your project.

amielantonio's avatar

if you happen to rename your classes and did it without using the terminal, you need to check the autoload-static.php and autoload-classmap.php for the Migration name and its corresponding migration table.

Ex. CreateEmpTable => {date}_create_emps_table. is giving me an error since Emp is singular while emps is plural. This caused my error. so I simply change them in the specified files and then run composer dump-autoload. then migrate.

JoshuaTroy's avatar

I had foolishly put:

namespace database\migrations;

Inside my create_users_table.php [2014_1012000000_create_users_table.php]

I was getting a similar error - Class 'CreateUsersTable' not found. Removing this line at the top solved this error.

Please or to participate in this conversation.