Getting set up for Laravel – Git, Sublime, and WAMP

Getting Set Up For Laravel

There are a ton of articles about how to set up Laravel and the author’s tools of choice, and I debated whether or not the Laravel community needs another. But seeing as I’ll be writing a lot of articles about Laravel and there may be people who, like me, have never used an MVC framework or Git before, I figured I’ll just write up a quick post. First up…

Setting up Git

If you were like me when you started coding, whenever you created a new version of a file, you’d save the old file with a date or previous version number tacked onto the file name. This quickly got out of hand and managing different versions of files became a huge headache for our alpha. This is where Git can help.

Git is a version control system typically used for code version control. When you start working on your first Laravel project, create a new Git repo for it. It may seem like a lot of overhead at first if you’re just going to be playing around, but the ability to undo an error that you introduced, say, two weeks ago, makes up for the added overhead. And if you aren’t using Git for your other coding projects, get that set up and learn how to use it before you begin using Laravel.

If you’re new to Git, I’d recommend reading through Atlassian’s Git Tutorials and Git’s own About page to get a basic understanding of Git and its features. I found Atlassian’s Git Workflows portion of the Git Tutorials to be especially helpful in understanding how to use Git on a larger project.

First, let’s get Git itself setup, which is just a simple download. If you’re on Windows and will be using the Sublime Text package SublimeGit (more on this in the next section),  be sure to select ‘Run Git from the Windows Command Prompt’ during setup.

Git Setup - Run from Windows Command Prompt

Source: http://wiki.team-mediaportal.com/User:HomeY/GitHub_(Git)/1_Git_Setup

Once Git is all set up, download SourceTree, a free Git client. I first started off with GitHub for Windows, and although it looks sleeker than SourceTree, it doesn’t give you transparency into how it manages your repo. SourceTree helps you learn Git terminology and the proper workflow.

The last step is to set up a hosted Git repo, which will allow you (and others) to access your repo from any computer. I’d recommend one of two options here: GitHub or BitBucket. GitHub is the standard for open source projects, so if you’ll be working in public repos only, then GitHub is your best choice. If you want private repos and control access to those repos, I prefer BitBucket over GitHub. This really comes down to price. For the SimpliFit dev team, we have 4 developers accessing our private repos. With GitHub this would cost $28/month, but this falls under the free tier for BitBucket (up to 5 users are free). If you’re a bootstrapped startup, like SimpliFit, this is really a no-brainer.

Sublime Text

Though I started off with Notepad++ for writing code on SimpliFit’s alphas, Sublime Text 3 is my code editor of choice these days. Sublime Text offers a lot of customization and it’s easy to add functionality with additional packages.

Once you have Sublime installed, let’s get Package Control, which simplifies the process of installing packages for Sublime. Head over to https://sublime.wbond.net/installation and follow the “Simple” installation instructions (don’t worry, it really is simple).

After installing Package Control, restart Sublime, hit ctrl+shift+p, and type install. The first result will be “Package Control: Install Package”, so hit enter to select. Now you can search for Sublime packages to install. I really use only two packages on a regular basis: SublimeGit and Markdown Preview. SublimeGit allows you to access Git commands from within Sublime Text (e.g., Git: Status), while Markdown Preview is indispensable for coding Markdown files (as its name suggests, it allows you to preview a Markdown .md file). If you include a readme file or add a wiki to your repo, you will most likely use Markdown to create those files.

WAMP

Before you can get Laravel working, though, you need some way to serve Laravel to the browser locally. Since I’m running my dev environment on Windows, I’ll be using WAMP (Windows, Apache, MySQL, and PHP). First, ensure you have Microsoft’s Visual C++ Redistributable installed. Next, download and install WAMP. I usually install WAMP to C:\wamp, but you’re free to place it wherever you want.

As of this writing, the WAMP version is 2.5, which includes PHP mcrypt (a dependancy that Laravel requires) already enabled. If you install a different version, check the following three files (replace php5.5.12 with the version of PHP that came with WAMP and the same with Apache2.4.9) and ensure there is no semicolon in front of the  “extension=php_openssl.dll” line (i.e., it isn’t commented out):

  • wamp\bin\php\php5.5.12\php.ini
  • wamp\bin\php\php5.5.12\phpForApache.ini
  • wamp\bin\apache\Apache2.4.9\bin\php.ini

Composer & Laravel

Composer is the package manager that Laravel uses to pull in dependances. Follow the installation instructions at https://getcomposer.org/download/.

And finally, head to http://laravel.com/docs/quick#installation and follow the “Via Composer” installation instructions.

That’s a wrap

And that’s it for my local dev environment. The next thing on my To Do list after the SimpliFit beta launch is to standardize the local dev environment using Vagrant. My one worry here is that although Laravel has Homestead (an official Vagrant file for Laravel), it includes Ngnix instead of Apache, which doesn’t align with our production environment. So there’s still some homework for me to do there.

Leave a Reply

Your email address will not be published. Required fields are marked *