Some Laravel “Gotcha’s” – Things to take note of when starting out with Laravel

Posted on August 4, 2013 in Web Dev

I am not a Laravel expert. I am writing this blog post as a Laravel amateur. My goal with this is to point other newbies in the right direction with some seemingly common and easily avoided Laravel mistakes. I’ve only been using it for about a week, but I can’t help but think that if I myself had a list of “Gotcha’s” prior to starting out with the framework, maybe I’d be deploying on day 5 instead of day 7.

Despite Laravel’s documentation being pretty good, there are a number of things you need to watch out for if you’ve never used it before.

1) Deploying with GIT? Your Laravel site will not work!

This one really got to me and took me a while to figure out. Now I know about it it’s ridiculously easy to avoid, but debugging this one took me a good (or bad!) few hours.

Problem:

The /vendor/ directory of Laravel is ignored with .gitignore file(s). When you deploy to your live server via git, you’re going to get an ugly error and generally have a bad time.

Solution:

You have a few choices here. What I’ve decided to do is simply recursively remove all the .gitignore files from the /vendor/ directory. This means they then are included in your next local git commit, and thus on your next pull should be pulled down to the live server.

The “proper” way of solving this issue is by utilising the composer system and running “composer install” and then “composer update” on future deployments.

Another way of getting around this issue is to FTP every time. But I’m not going to recommend this 🙂

Recommended reading:

http://forums.laravel.io/viewtopic.php?id=9814

___

More gotchas coming soon!

Leave a comment

Was this helpful? Did I miss something? Do you have a question? Get in touch, or tell me below.