Clear Laravel 4 Autoload


Laravel 4 currently has a very frustrating issue. If you add a model it will not know of it until you clear the autoload.

[ps]composer dump-autoload[/ps]

Make sure you have setup composer to be accessed globally. Otherwise you'll need to do this command.

[ps]/usr/local/bin/composer.phar composer dump-autoload[/ps]

Further you may want to optimize your autoload. According to Taylor this can speed up your application by 30%.
[ps]composer dump-autoload --optimize[/ps]

Edit: Another option noted by luviyo is to do the following.

Open app/starts/global.php and add:

[ps]ClassLoader::addDirectories(array( app_path().'/libraries', ));[/ps]

Thanks for the tip!