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.
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.
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 🙂
More gotchas coming soon!