This is the first of a new collection of posts that are dedicated to reviewing tutorials I find while learning my own thing. A lot of tutorials are outdated or wrong. “You mean things on the Internet can be wrong?!” In my field I run into a lot of tutorials. Ones that are large enough to warrant a review, either being very bad or very good, I will post about. This one is about installing Laravel.
Unmatching tutorials suck.
Disclaimer: This is not a tutorial, but might be used as one?
For reasons unknown to most humans I have ventured into the dark abyss that is web development: I touched node.js, “ew!”
When I did this I accidentally used the 5.1 version of the quick start tutorial from here. Some of my issues was simply from that, and I will remark appropriately.
Setting up the VM
Using the ever fabulous service that is Rackspace Public Cloud, I booted up a Ubuntu 15.10 instance. After doing some basic bootstrapping I began to install laravel.
Installing laravel copypasta mode
#install basic packages
sudo apt-get update
sudo apt-get install php5 apache2 libapache2-mod-php5 mysql-server php5-mysql curl -y
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
#install your laravel project
composer create-project laravel/laravel quickstart –prefer-dist
I used this as a reference.
Setting up the database (here)
I didn’t have to much trouble with this part but definitely set up the database connection string incorrectly. I was expecting data to be setup in
config/app.php. Alas it was in
.env in the project root.
Stubbing the routes (here)
A couple issues here, all of which were my own:
- I forgot to include the
usestatements at the top, “hey that’s important!”
- In the 5.1 version the routes are not inside of the required
middlewaregroup: this caused a very difficult to debug
$errors variable not founderror.
- Ran into a ‘client denied by server configuration’ error that was fixed by changing my vhost configuration
The middleware solution was found at this stackoverflow post.
The vhost solution was found at this stackoverflow post.
Building Layouts & Views (here)
In hindsight this is where I am the most upset. The laravel folk show this lovely bootstrap themed image, and it gets me pumped up. In both tutorials it absolutely does not explain to you how to get bootstrap integrated properly with laravel. I’ll get to that near the end.
I use vundle and the line I needed to add to my vimrc was:
Adding Tasks (here)
I found this portion of the tutorial to be well written and easy. The
validator portion of the tutorial looks pretty great. After working with neutron’s validators I am so happy that this looks sane.
That said, I ran into another weird problem here that may have just been skipped in my installation procedure. Some of the routes, namely
POST /task, wasn’t being found. The solution was to enable mod-rewrite:
This solution came from this stackoverflow post.
Deleting Tasks (here)
This portion of the tutorial was pretty self explanatory.
Getting bootstrap working with laravel
Why do I look different, dad?
I used this tutorial to get bootstrap installed.
Getting bootstrap to work, what I imagined is the correct way, was somewhat complicated:
- you have to touch node.js
- even this tutorial had its own problems
I’m not sure about node.js development, but in python land running stuff with
sudo is generally bad news. This is a VM though, so who cares!
Problems and their solutions:
sudo npm installdid not work well
When I ran
bower later on it gave me the following error:
/usr/bin/env: node: No such file or directory
“What!? I just installed this thing…” Well it turns out I didn’t. This stackoverflow post gave me the solution:
sudo apt-get install nodejs-legacy. Already legacy nodejs? Deprecating babies…
After that everything worked out alright except the css styles weren’t showing up. Turns out I forgot to run
sudo gulp. Also turns out
laravel-elixir did not install (due to the same legacy issue). I ran
sudo npm install again and everything worked out ok. I referenced the laravel elixir page when installing this.
You don’t get what is on the box when you run through this tutorial and it is incredibly disappointing. If you want to make it match then you definitely need to do some googlefu (which you should be doing anyway).
Good parts of this tutorial:
- learned enough to understand the MVC model of laravel
- touched a bit of the ORM and database bits to know how it goes
Bad parts of this tutorial:
- Somehow got to the wrong version from google? That seems like SEO gone awry
- The pictures, literally the only picture in the tutorial, is just not possible to achieve with the tutorial
- There is a bit of a disconnect between the installation guide and this tutorial. It does not actually tell you how to get this project on the web
Final Score: 4 / 5