Laravel VS Ruby on Rails.

Since a lot of people come to this blog searching for the answer if Laravel is better than Ruby on Rails, I will post a short biased comparison of the two, and I will tell why they shouldn’t be compared.

I had started developing web applications about two years ago in one of my classes at the university. The number one web development tool at that time was Ruby on Rails.

When the teacher(the most awesome teacher I had at school) showed us what you could do with Ruby on Rails and how quickly it could be done, it was like magic to me. I didn’t believe that RoR could be so intelligent, it’s like you feed almost human-like language into it and it automagically spits out a nice web application at you. I developed a few small applications with Ruby on Rails, one is an interactive seating chart with a backchannel (kind of like chat) and another one is Clicker-like online polling, the two are located here: http://severe-dusk-953.heroku.com/ and http://young-mountain-432.heroku.com/ and their sources are at https://github.com/msurguy/CS-473-Clickaz-app and at https://github.com/msurguy/seatingchartAJAX

I was really passionate about Ruby on Rails at the moment. I watched screencasts on Railcasts, I read lots of Ruby on Rails blogs, followed top contributors’ posts and attended local Ruby Meetups. The culture was really awesome and the environment was encouraging. I bet if school didn’t get in the way with other priorities I would’ve continued doing stuff with RoR.

After the class and after the initial amazement about RoR I started to face problems with even simple things and I had no quick answers that I needed to keep pushing forward so I slowly lost interest. When I wanted to start over there was no quick way to get RoR running on my brand new computer, so I again postponed development with RoR.

Fast forward a year and a half, I was working with a startup and it came to a point where I needed to choose the right framework to build the product on. Ruby on Rails came first to mind but I remembered how much pain I had just getting the thing running on my local machine and how hard it would be to find somebody near me that could do really great RoR coding. I decided to stick with PHP and looked in those waters instead. A few days and over two dozen frameworks later, I found something that seemed clean enough, not overbloated, with a great community and with great simplicity. Sure enough, it was Laravel.

Why? With Laravel I developed an application within the first hour of actually discovering the framework, without any prior experience with PHP frameworks. It was a breeze to get it up and running on my local machine, actually on both PC and Mac. It has very eloquent and expressive syntax, just like Ruby on Rails, and in my opinion the structure is cleaner in Laravel.

Both RoR and Laravel use ORM that simplifies database queries. I don’t know how good RoR is right now to say about its ease of use with all kinds of databases. Laravel supports the following databases out of the box:

  • MySQL
  • PostgreSQL
  • SQLite
  • SQL Server

Both RoR and Laravel have addons, in RoR they are gems in Laravel they are Bundles. Easily pluggable into your application.

In RoR : gem install nameofthegem

In Laravel: php artisan bundle:install nameofthebundle

Both RoR and Laravel are MVC frameworks to keep the structure of the application separated but I think Laravel is more forgiving about that and sometimes that could be a drawback since the code can become un-pretty if the developer isn’t experienced. But hey, at least the developer wouldn’t be discouraged because the code will still work!

One major selling point of Laravel for me was the human-friendly documentation. I remember in RoR I had to dig through a ton of online examples and climb on shoulders of others before I could find the answer I am looking for. I never even dared to look into the inner workings of Rails.

With Laravel the documentation is as clear as it could be, with lots of real examples that could be easily modified to suit my needs and developed upon. It brings joy to my heart to see an easy example for each subtopic in documentation. Like this:

Route::get('user/(:num)', function($id)
{
    //
});

Laravel itself is written in such a way that it welcomes others to look at what’s inside. The online API  is just as clean as the documentation, simply a huge help for the developer.

Maybe there are so many books and tutorials about RoR because people have trouble understanding it in depth to figure stuff out? I don’t know…

I admit that I came to PHP world being spoiled by the magic of RoR, so in Laravel I found that what I didn’t experience with Ruby on Rails, being able to go from zero to an application in ridiculously short amount of time. The magic of developing was again found for me, though in a different world from RoR.

In my opinion RoR and Laravel shouldn’t be compared. They are two different platforms, two different ecosystems, they both have lots of good things about them and since nothing is perfect they also have their drawbacks. The choice should be only yours, try out both things and see how quickly you can build a great application. I made the choice based on experience, not on just what others tell me, and I would encourage you to do the same!

You may also like

  • You mention having struggled with Rails in ways that you didn’t struggle in Laravel. What I’m interested in is what in Rails you had issue with that was easier in Laravel.

  • HAML would be one struggle.

    Trying to find a missing css dependancy nested 13 folders deep inside of a compass project is another.
    Rails conventions over config tend to leave a lot of things unexplained and come back to give you WTF moments

  • Maks Surguy

    First and foremost, ease of getting going, in very few steps. The especially going from zero to a start page of the application.
    Structure of applications in Laravel is more transparent and easier to understand even for somebody who has never done frameworks, just the simplicity is something that won me over from Ruby on Rails.

  • Niall O’Brien

    You gotta admit that Ruby is a nicer language, Rails has excellent testing tools and gems for just about anything.
    One huge downside to Rails (for me) is ease of setup. With PHP, I dev using MAMP and I’m good to go in no time at all. I don’t need to fiddle with gem/bundles just to get a simple project off the ground.
    Laravel4 will be more similar to Rails, as it will be using Composer packages (gems for PHP) but at least it’ll mean a package will work for any PHP compatible framework.
    Laravel is easier to learn, although the docs do lack in certain areas, however, because it’s more lightweight than Rails, I find it easier to grasp.

  • I’m not sure if I agree that Rails is all that hard to setup, but to deploy. Laravel is faster, more portable, lightweight and easier to learn.

    I like the ruby syntax sugar, but I’m totally fine without it.

    Laravel have basically everything that rails have, plus: “Laravel is PHP. Aside from javascript. it’s the most ubiquitous language ever. In an economy where 8% of us are unemployed, choosing a solid language like PHP is a really good option.” – bngreer

    I’ve done some comparison in my blog too:
    http://www.zizaco.net/2012/10/rails-vs-modern-php-frameworks/

  • Thank you, this balanced opinion has given me an idea on how to move forward with my self-improvement endeavors.

    As a PHP developer who gets to choose between learning Rails vs. Laravel *today*, when Laravel is even available, I’d say Laravel is the best choice for making my next app or two on. Back when Rails was released there was probably no equivalent RAD framework with those kind of superpowers, and hence it became so popular. Today, the value in learning Rails lies in being able to take advantage of the vast amount of knowledge generated about TDD, BDD, and Agile methodologies in the RoR ecosystem. If I learn Rails, and maybe build a test app on it, it would be to better understand what the masters are talking about in terms of development best practices.

    Ruby is a different beast altogether, I am learning it anyway despite not being much interested in RoR because of the obvious value of being exposed to a new language and its ecosystem – plus the beautiful, tasty syntactic sugar present in the language. Thanks again for validating my beliefs 🙂

  • I have heard about laravel a lot. I really need to learn a framework and laravel is on top my list.

    But my concern is the community , how big is it, can i find solution over the internet. Is it going to be long term project.

    I am taking point of Zizaco, pointing that Laravel has everything as RoR.

  • I am a mobile dev. Android, J2ME, SMS USSD based in Kenya.

    I’ve gained much interest in Laravel over the past week and I’m making some serious consideration on learning and implementing a few web apps with it. My major trilemma has been comparison between CI, Laravel and Ruby on Rails. Thanks Maks, this blog has helped in my research.

  • Maks Surguy

    Glad you find the blog useful! Tell others about it =)

  • The only thing that prevents me from learning PHP is the language itself. In case of Ruby, i can easily understand other’s code in github, hack on it, or just find an expert on the internet to ask. The Ruby language’s beauty is awesome, consistent and encourage coding. PHP language, it’s not consistent, because not everything is an object. It’s the critical point here. Maybe in future, i would change my point to learn PHP, but Ruby makes myself as a developer a better developer.

  • Eptis

    Lets create a hybrid, Ruby on Laravel

  • JoeDRL

    I had a dream last night where Laravel was actually written in ruby! Damn that was soooo good….

    If only I had the time and skill!

  • Maks Surguy

    haha, what would be the advantage of that?

  • I think Laravel is a good choice for PHPer who want a Rails like framework

    Laravel is so good!

  • edo

    I’m using CI to develop and I think both Laravel and Rails better than CI and maybe I have to learn both

  • Maks Surguy

    Have you heard that CI is dead by now?
    Of course it is better to switch to something more modern, and well, something that’s alive and kicking =)

  • Thanks for your informed opinion. My personal impression (disclaimer : I develop in Rails, and have just read the Laravel doc) was actually that Laravel was very similar to Rails (I’m finding myself very confortable when reading about Laravel, as I’m already used to most of the concepts). Of course, for better AND worse, PHP is not Ruby, but the principles of both framework looks rather similar. Is it correct ? Could you point out major differences (apart from the language) ?

    Thanks,

    Martin

  • Mirko

    Laravel is great. RoR is great.
    But I find it faster to develop using RoR.
    And have you check Rails Guides? I mean Laravel has a great documentation, but Rails has even better.

    Still only love to both frameworks 🙂

  • Paul Goulart

    I’m really liking Laravel and I’ve been working with Rails since 2006. The biggest difference is I’m able to deploy Laravel on inexpensive shared hosting and don’t need a server expert to get this deployed.

    With rails there is significant work to get things running consistently locally, and deploying it to a server is another unwelcome hurdle unless you’ve got money to pay to get the server set up properly.

    I didn’t like Haml. I also like the vibe of Laravel.

  • Totally agree, not sure he found comfy with larval. Comparatively rails is a easy framework.

  • Pratik Joshi

    Codeignitor is reborn now ! 🙂 congrats!

More in Code Blog
bootsnipphome
Announcing Bootsnipp.com – Twitter Bootstrap HTML snippets

Today I am announcing my new creation made with Laravel PHP framework : Bootsnipp.com What is Bootsnipp.com? Bootsnipp.com is a...

Close