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

kushpal's avatar

ReflectionException: Class log does not exist in /home/vagrant/Code/

getting this error after composer update Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist' in /home/vagrant/Code/newproject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 745 ( ! ) ReflectionException: Class log does not exist in /home/vagrant/Code/newproject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 745

0 likes
62 replies
bashy's avatar

Make sure your namespaces are correct when referencing a class.

Probably have something like new Log(); when it should be new Acme\Log(); replacing Acme whatever your namespace is.

Or maybe Log() is log() by mistake

rapliandras's avatar

I've just ran composer update and got the same error. There's something wrong in the remote repository. I'm also trying to find a stable version instead of the current 5.0 dev, will return and tell if I've found it.

2 likes
rapliandras's avatar

The funny thing is I was happy with my passing dev branch of lara 5 for weeks, I just wanted to pull Facebook SDK through the composer, then it exploded :D

Mattiman's avatar

As Bashy explains in so many words ;) the dev branch will break things from time to time at the moment :)

rapliandras's avatar

I've managed to restore the working version via git (the default .gitignore has to be edited), so if you use git, your day is saved! :)

bestmomo's avatar

Dont try to use tiers package with L5 before it gets more stability.

rapliandras's avatar

@kushpal of course not

The workflow for reverting to the working version looks so:

Given the code on a local and on a testing / production environment separated.

  1. You messed up the prod env with composer update.
  2. Go to your server and edit .gitignore, remove /vendor from it
  3. Do the same with your local files
  4. On your server, git stash
  5. On local, git add -A, git commit -m "working 5.0 dev", git push
  6. On server, git pull

  7. refresh your website and check if it works

luqmanrom's avatar

Got the same error here after running composer update. Was working fine before that.

Update: I just git stash my composer.lock, removed my /vendor folder and ran composer install. It works! There's definitely something with one of the package updates.

Here's my composer.lock that worked (quite recent): https://gist.github.com/afifsohaili/47b10533789bf9d2f89f

fenos's avatar

@afifsohaili I tried to remove the vendor directory and composer.lock, then i run composer install but the problem is still there. What i missed?

encodia's avatar

Same problem here, couldn't find any work-around.

rapliandras's avatar

Guys, the only current way to fix this is having a backup of vendor folder. As Taylor replied on Github, he has some flu at the moment, so this wont be fixed in days. If you are in an early stage of development, you'd better switch to one of the stable versions: 4.3, or the über-stable 4.2, which has all the major and minor tests passing.

i960's avatar

Make sure you are merging in the updates from laravel/laravel in addition to composer update (which pulls in changes from laravel/framework). There have been changes on both sides that go together.

The only issue I seem to be having at the moment is an infinite redirect loop after logging in. Not sure if I did something or if that problem has always existed. Of course, I'm using the default auth boilerplate which has been removed for the time being.

TimVanDijck's avatar

Did a composer update and got the same problem.

I fixed it by moving the "config" folder into the "resources" folder.

encodia's avatar

Moving the "config" folder into the "resources" folder didn't work for me.

rapliandras's avatar

@TimVanDijck I'm not sure how you got the right result, but you shouldn't do structural changes at all. Even if the code isn't, the structure itself it pretty solid and will surely not change until the release.

luqmanrom's avatar

@TimVanDijck Moving "config" folder into resources works for me. Ran composer update and everything works now.

encodia's avatar

We "download" again laravel-develop, in a new fresh project, run composer update. It works fine.

kushpal's avatar

whenever, i stuck... i have to do fresh install? i dont think its a good solution.

ELD's avatar

@kushpal you really shouldn't be using Laravel 5 unless you're prepared to keep up with the numerous changes that keep coming down the pike.

However, a way to keep track of the changes is to add the laravel/laravel repository as a remote on your local git repository. Every time you get an issue with a composer update, you can run a git fetch and merge the changes yourself to keep up to date with the laravel/laravel repository without having to do a fresh install. It's a tedious process, but it's possible.

encodia's avatar

We are trying to use Laravel 5, not for production purpose yet. So a fresh install is a good solution, for us.

kushpal's avatar

its worked fine now.. i simply add the config, lang and assets in resources folder.. if someone dont have resources folder create it manually.

1 like
pmall's avatar

You just have to reflect the code from the main repo. I remember a log service provider was added at some point, so check your config/app.php file to include it with it's aliase.

semsphy's avatar

I'm suck. I do all my best to solve the problem, but I can't. I followed you guys instructions, but I have no luck. I don't want to a fresh install. Any idea, please.

rapliandras's avatar

@semsphy look for some earlier 5.0.* code on the web. Replace vendor folder only.

 // Come back in 2 hours, if found none, I'll upload my own

But it definely has to be up in github repos at least.

bugi's avatar

I've reverted the laravel/framework version in composer.json to

"require": { "laravel/framework": "dev-master#846c935194a036901ba6b4397c8897fa51e19111" },

this commit was before the breaking changes were introduced. This let's by the way run way/generators and barryvdh/ide_helpers again.

On the other side you're stuck on this version until the issues are resolved by taylor.

Next

Please or to participate in this conversation.