Ruby on Rails vs. Laravel: Getting Started

There are currently many popular frameworks for online web application development. There are also different types of frameworks, such as those with plenty of additions and extras, which allow for faster iteration (such as Rails) or others that are very simple and low-level (such as Flask).

Two of the more popular frameworks for web application development is Ruby on Rails and Laravel. They are both very mature projects which have been around for quite some time. Ruby on Rails was introduced in December of 2005 and Laravel was in February of 2012.

As shown by the date of the first release, Laravel is newer however this doesn’t make Rails old, as the community has always innovated and continued to iterate the project by introducing newer, smarter and better tooling. Also, Laravel has picked up extremely quickly.

A very small and simple indicator of developer interest is the number of GitHub stars of the project. Ruby on Rails has accumulated 22,000 over 8 years yet Laravel has around 11,000 in around 2 years only. However, this could very well be because PHP is a far more common language that is more accessible than Ruby on Rails.

We’re going to have a quick look over different components that are important when designing and developing web applications and the pro’s and con’s of each framework in these components. The criteria we selected is based on what we consider important as developers ourselves. In this article, we talk about how easy it is to get started with both Ruby on Rails and Laravel.

Getting Started

One of the criteria we selected was how easy it was to get started within a framework. In this case, it’s basically how fast you can start to write your web application code.

Rails

With Rails, as long as you have Ruby installed on the machine you want to develop on, all you need to do is run the following command:

$ gem install rails

With that simple command, it will pull in all the dependencies required for Ruby on Rails and install it on your machine. With most OS X machines coming pre-installed with Ruby and Linux machines being a command away from Ruby being installed on your machine, it makes it even easier.

If you want an Ubuntu 14.04 LTS environment with Ruby on Rails on our cloud computing service, all you need to do is boot a new server, login to it, install Ruby then install Rails. Just that easy.

$ nova boot --flavor nb.2G --image "Ubuntu 14.04 LTS" --key-name MacBook rails-dev
$ nova ssh rails-dev
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-29-generic x86_64)

* Documentation:  https://help.ubuntu.com/
root@rails-dev:~# apt-get update
root@rails-dev:~# apt-get install -y ruby ruby-dev make
root@rails-dev:~# gem install --no-ri --no-rdoc rails

That’s all you need to install Rails. Once it’s installed, you just need to create a new application and start hacking away. This is probably the easiest part of this all.

$ rails new weblog

To start the built-in Ruby on Rails server, you just need to start the built-in Ruby on Rails server by changing into the project folder and starting it.

$ rails server

You’re now ready to serve requests and write your web application code. This process most likely takes less than 5 minutes including Ruby installation. If you already have all this installed, it’s probably less than a minute to start a project.

Laravel

PHP is most likely the most accessible language for web developers. The reason for this is that the majority of hosting services provide PHP as a language which can be used on the server side. However, for the scope of this article, we’ll assume that the user will be running it on their machine or on a server. However, it is a strong getting started advantage that it can be used on most typical hosting platforms.

PHP comes shipping by default with OS X and it can also easily be installed on any machine, Laravel has an extremely simple and easy to use installer.

If you want to get a Ubuntu 14.04 LTS environment with Laravel on our cloud computing service, you’d just need to create a server, install PHP on it then run a few simple commands as follows

$ nova boot --flavor nb.1G --image "Ubuntu 14.04 LTS" --key-name MacBook laravel-dev
$ nova ssh laravel-dev
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-29-generic x86_64)

* Documentation:  https://help.ubuntu.com/
root@laravel-dev:~# apt-get install -y php5-cli php5-curl php5-mcrypt
root@laravel-dev:~# php5enmod mcrypt
root@laravel-dev:~# wget -O /usr/local/bin/laravel http://laravel.com/laravel.phar
root@laravel-dev:~# chmod +x /usr/local/bin/laravel

That’s all you need to install Laravel. The next step is to create an application and the process is just as easy as Rails.

$ laravel new weblog

If you want to use the built-in PHP development server, all you need to do is to be in the directory of your application and run the following command:

$ php artisan serve

That’s it. You can now just go to the URL provided there and you’re ready to start writing your application. This entire process takes around 5 minutes for a clean install and probably less than a minute for new projects.

Conclusion

It seems that both applications are extremely easy to get started with and require less than 5 minutes to setup from scratch and even less if you already have them installed. This means less time tinkering around to get the right development environment and more time solving solutions.