Ruby on Rails vs Laravel Comparison: Which Framework to Choose for Your Next Project? (UPDATED)
Behind every great product is the story of hard decisions that turned out to be great decisions.
Right after the question “What should we do?” comes another important question: “How should we do that?” - we’re not able to make this decision for you as there are too many tools and ways of implementing things making it impossible to know them all.
This article will help you compare two available technologies before creating your next web application- Ruby on Rails and Laravel.
First things first – what is Ruby on Rails and Laravel? Simply put, both are well-known web frameworks widely used in the development of web applications.
Frameworks are libraries of code whose purpose is to make the development or maintenance of web applications easier and faster.
They usually provide out-of-the-box solutions for popular development tasks- for example:
- Connecting with a database
- User authentication / authorization or integrations with third-party services like Facebook or Stripe
- Allowing the developer to generate huge sections of code with just a few clicks - which can make development even easier in the early stages
Ruby on Rails is a very popular framework written in Ruby - its first version was published in 2004 by David Heinemeier Hansson and is currently available as version 6.0.3.
Laravel is much younger as it was released in 2011 - this PHP based framework advertises itself as a “framework for Web Artisans” (Artisan is also Laravel’s built-in command line tool) and for “people who love beautiful code”.
This description might sound familiar to Rails developers since Ruby is also known for its purity and readability.
The Battle of The Giants
The languages in which Rails and Laravel are written in – Ruby and PHP – are very popular in web development.
Despite its “ease of use” Ruby was widely decried for being slow - Twitter was initially developed in Rails but experienced some performance issues due to processing millions of requests per second.
This issue was addressed and Rails' performance increased drastically between 2004 and 2020 but the label of a slow language has stuck to Rails. But we hate labels, don’t we?
PHP on the other hand, has existed since the very beginning of the web in the early 1990s. Even though it’s considered to be messy and almost impossible to maintain by developers working in other languages, some of the biggest web applications (does the name 'Facebook' ring a bell?) use it.
'How many people know how to use it?', 'How hard is it to learn?' and 'Is it well maintained with a helpful community?'
These are probably the most important questions to take into consideration when comparing programming languages or frameworks in terms of the cost of development.
Ruby is considered a language that’s quite easy to learn, as its syntax seems very similar to English – some parts of the code can almost be read as natural language sentences.
PHP seems much harsher – it is considered hard to read and chaotic, especially in comparison with Ruby. On the plus side, PHP is definitely more popular in educational facilities and is seen as less abstract.
It’s hard to decide which framework is more popular as there are plenty of different communities on the Internet. One thing is certain - both frameworks have huge and helpful communities built around them.
Let’s have a look at some numbers coming from the most popular sources.
According to Google Trends, Laravel quickly became more popular than Rails, which is quite obvious as there are more PHP developers than Ruby. Rails on the other hand, has enjoyed very stable interest which has decreased only slightly over the past five years.
There’s no better place to visit when speaking about communities than Reddit. Let’s have a look at the numbers: the subreddit for Laravel has 507,000 readers, while the one for Rails has almost 46,000. The difference is comparable and remember that Laravel is twice as young as Rails.
Stack Overflow is the home destination for almost every developer in the world. This is the most popular knowledge market and an oracle for programmers. There’s simply no other place with so many answers to so many problems and questions. The numbers here also speak in Rails’ favour: 320,768 questions asked about Rails versus 156,985 about Laravel.
Another Brick in the Wall
Usually, programming means building things using stuff other people have already built. You can think of web development as building unique things with bricks. But how many bricks do our frameworks provide?
In the Ruby world, these bricks are called gems (fancy, isn’t it?). Technically, RubyGems is a package manager for Ruby which was present in the Ruby community almost since the beginning of the language in 2004.
There’s a saying amongst Ruby developers that "theres probably a Gem for everything". What’s more surprising, that saying is almost entirely true.
And if there isn’t a gem for something, it will probably be written sooner or later. There is a gem that provides user authorization or manage user’s roles and abilities in your application, and there is also a gem that turns your test’s output into a rainbow.
To give you an idea on the size of this community let’s have a look at some more numbers. The repository has served over 58 billion downloads of over 162,000 of gems.
Composer and Packagist
For a long time in PHP there was no easy and centralized way of managing libraries and dependencies.
The situation changed in 2012 with the release of Composer, a package managing system for PHP. It uses Packagist - the PHP Package Repository. Its statistics are impressive as well: over 282,000 packages installed more than 28 billion times since April 2012 - for a bunch of tips on getting started with Composer take a look here.
Those results, of course, are about libraries for entire programming languages – some of them are versatile, while others can be used only for specific frameworks and tools. We can say one thing for sure - for developers working in both the Ruby on Rails and Laravel frameworks – the sky is the limit when it comes to browsing and using packages.
Our comparison comes to a draw.
Below we will summarize what we have learned and find the strongest and weakest points for each of the frameworks and figure out which will fit your business needs best.
Ruby on Rails
Ruby on Rails older but still a very modern framework. It has a big and active community and is relatively easy to learn. It provides tools for scaffolding your application and makes development quicker in the early stages.
Due to Ruby’s readability, apps developed in Rails are self-documented which can make the understanding of implementation details much easier if you have some technical background. Unfortunately, Ruby is still considered to be a slower language, so it might not be the best choice for you if you want exceptional performance.
The differences are not big though, and many changes have been introduced throughout the years with the last update on September 9th, 2020. It's also worth noting that not every hosting service supports Rails - here are the top 5 that do.
Rails has proven that it’s a very universal framework despite some minor disadvantages. Just have a look at some of the applications developed in Rails:
- Airbnb: Apartment booking system
- Twitter: One of the most popular social networks
- Twitch.tv: The most popular gaming livestream service
- Github: Service for managing git repositories
- Kickstarter: The most popular crowdfunding service
PHP seems to be a very unfriendly language (in comparison with how much is ready to use in Ruby), but it definitely is more popular in education and amongst developers in general.
Consequently, it should be easier for you to find someone to work on a PHP project. Laravel also provides a good routing system, which makes developing REST APIs (Application Programming Interfaces) easy. Laravel is worth considering if your application only relies on providing data to other apps.
Ok, so we’ve gone through quite a lot of information but we still didn’t answer the question: what framework is better?
Sadly, there’s no definite answer to this question.
You can take into consideration many different aspects and still, after your product is finished, someone will come by and say that they could have done it better, faster, or cheaper. If you’re looking for a verified and battle-tested solution used in many successful projects, and you’re not a performance freak, Rails is probably the better choice.
On the other hand, if you want to try a new and very promising technology or just want to have API, you should consider Laravel.
The best way to decide is to become familiar with the use cases for each framework and to speak with developers working in different technologies- ask them questions and try to learn their point of view and get some estimations for your unique idea before choosing which is right for you.
You can also contact Netguru to lend a helping hand - we would love to hear from you.