Last Updated: February 25, 2016
·
36.73K
· benjaminrh

Solving "Class not found" errors in Laravel 4

If you're new to Laravel 4 and Composer, you might be confused when you start getting errors like this:

PHP Fatal error: Class 'BlaClass' not found in project/vendor/laravel/framework/src/Illuminate/Bla/Bla.php on line xyz

This has to do with Composer's class autoloading, and is very easy to fix. Run composer dump-auto, and then try re-running whatever you were trying to do before, which should now work.

7 Responses
Add your response

Whoa! Working ! cool, I'm just wondering why is this happening?

over 1 year ago ·

Thank you so much, I have been looking quite a while for an solution!

over 1 year ago ·

Would be helpful if you had some suggestions for when dump_autoload doesn't suffice.

I still get Symfony \ Component \ Debug \ Exception \ FatalErrorException
Class 'View' not found

It's like if Laravel isn't loading the Views class? How to verify that ?

over 1 year ago ·

+1: it'd be helpful if you had some more troubleshooting tips. Autoloading is awesome, except when it doesn't work... then it's power is turned against you.

over 1 year ago ·

If you're in a package and it's still not working, you need to prepend your class name with a \

\View::make('index');

over 1 year ago ·

wow..! append with \ works for me
i don't know the reason of using '\'. can anyone explain..?

over 1 year ago ·

Because the '\' forces to use the namespace starting from root!

over 1 year ago ·
  NODES
camera 1
Community 1
composer 6
html5 1
iOS 2
Javascript 6
os 11
Verify 1
web 1