nhwq8w
Last Updated: February 25, 2016
·
31.72K
· benjaminrh
2aca501921a5a98762cc4af16da258b8

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.

Say Thanks
Respond

7 Responses
Add your response

8269
583a5991912fcc760caab72c1318371a

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

over 1 year ago ·
8469

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

over 1 year ago ·
11585

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 ·
12141
8fd910b4f7c7baabc22976dc6b29b744

+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 ·
12209
61d35108ebaead8df8b1a92d713c00fb

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 ·
17133
None

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

over 1 year ago ·
20694
11081408 10206479077515676 2530952054044575339 n

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

over 1 year ago ·
Filed Under