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

Ronster's avatar

ReflectionException after deploy

Hi,

On my homestead my app works perfect. Now I would like to bring my site live (I have created a soccer game with live score statistics so tonight is champions league and i would like to test).

In laravel Forge the deployment log shows me the following message: "exception 'ReflectionException' with message 'Class App\SoccerMasters\Models\Fixtures\Fixture does not exist' in /home/forge/voetbalmasters.eu/vendor/laravel/framework/src/Illuminate/Container/Container.php:747" so the deployment fails.

I am debugging on this a few hours now but can't find the problem/difference between homestead and forge.

Anyone who as ideas to fix this? I am using L5 btw

edit* the following code is causing the problem

function __construct( Container $app ) {
    $this->model = $app->make( $this->modelClassName );
}

$this->modelClassName refers to App\SoccerMasters\Models\Fixtures\Fixture

0 likes
2 replies
joshreisner's avatar

I'm having the same trouble! I've got a package that calls middleware from a package, but on Forge this throws a ReflectionException saying the class doesn't exist. The maddening thing, however, is that it works great on my local computer, no differences between the environments that I can think of.

Did you figure out what was going on?

natcave's avatar

I know this is an old post, I just wanted to leave a comment in case someone was searching for a solution. In my case I had forgotten to add some files to my repository before pushing to production (notably, a new middleware class in the mix). That explained why it worked fine locally because the app worked with the local files whether or not they were added to the repo. After adding, committing and pushing the new files the error went away. Hope this helps someone.

Please or to participate in this conversation.