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

rtacadena's avatar

How to seed database after deploying the Laravel app on production Heroku?

I successfully deployed a laravel in production in Heroku but when I run 'heroku run php artisan db:seed' I got this error:

[Symfony\Component\Debug\Exception\FatalThrowableError] Fatal error: Class 'Faker\Factory' not found

Does any one of you get the error deploying on heroku?

I use cleardb add ons.

When I run 'heroku run php artisan migrate' in production it all works fine only the heroku run php artisan db:seed' has error. It all works on development side, but in production I got the error.

It seems like in the Faker library id not loaded in the DatabaseSeeder class? Is there a problem on my composer not loading the Faker library? or permission on vendor folder?

I will appreciate any help. Thanks.

0 likes
5 replies
rtacadena's avatar

@willvincent I am desperate to fix the issue hehe, seems like no other people respond to my question yesterday excpet you. I already checked namespace and it all works on local but it production it fails.

EmilMoe's avatar

Change

    "require": {
      ....
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",

to

    "require": {
        "fzaninotto/faker": "~1.4",
    },
    "require-dev": {

in composer.json

1 like

Please or to participate in this conversation.