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

KalimeroMK's avatar

Database seeder not working

Hi all Im trying to run big seeder and it trows error Class not found but is present need help ho to seed this file I have the file on local machine and want to seed it

https://raw.githubusercontent.com/KalimeroMK/seeder/main/CitiesSeeder.php

0 likes
9 replies
LaryAI's avatar
Level 58

It looks like you are trying to seed a file from a GitHub repository. You will need to download the file and place it in the database/seeds directory of your project.

Once you have done that, you will need to register the seeder in the DatabaseSeeder.php file. You can do this by adding the following line of code:

$this->call(CitiesSeeder::class);

Finally, you can run the seeder by running the following command in your terminal:

php artisan db:seed
KalimeroMK's avatar

@LaryAI I have the code on local machine and i run it just like you send and it trow class not found i put it online so people can see it

KalimeroMK's avatar

@Sinnbeck

Target class [CitiesSeeder] does not exist. But if I remove the seed data left only 100 lines it is op it is working but if it is the full seeder not found

Sinnbeck's avatar

@KalimeroMK Maybe it cannot load the file in memory as the file is HUGE. :) It might be better to use an sql file for the seeding if the data comes from a database (it looks like the file is generated by some seeder package)

KalimeroMK's avatar

@Sinnbeck the problem is I have used iseed package to generate it fot database 5 y ago and don have sql file only the seeder and i need the data

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@KalimeroMK so either use another computer to test or split it into multiple files? You can also try incresing the max memory in php and see if that helps

MohamedTammam's avatar

You should use \Illuminate\Support\Facades\DB instead of \DB.

use Illuminate\Support\Facades\DB;

DB::table('cities')->insert(...

Please or to participate in this conversation.