Ruby On Rails or Laravel, which do you use?
Web frameworks are libraries of code with varying degrees of functionality written in a programming language to carry out common web development tasks. Common tasks include authenticating users, reading, writing, updating the database, sending emails and interacting with third party APIs (such as LinkedIn, Facebook and Twitter). Web frameworks run on the server side of the application and process requests from web clients (such as browsers, iPhones, toasters etc). Laravel is written in the PHP programming language. Ruby On Rails is written in the Ruby programming language.
Ruby On Rails and Laravel both operate off of the Model View Controller (MVC) pattern. This means that both frameworks use their respective programming languages to model tables in the database, views in HTML and controllers to process requests. In both frameworks the general flow is user sends request from web browser (the View), the Controller handles the request and invokes a Model which then updates the database. Changes are then reflected back in the View via the Controller.
Additionally, both frameworks rely on Relational Databases. This means the data is structured similarly to the way Excel spreadsheets are laid out. There are columns and rows. Structured Query Language (SQL) is what the programming languages use behind the scenes to issue database commands. Developers use web frameworks in part because it allows them to write PHP or Ruby instead of raw SQL queries, making them more productive.
Ruby On Rails is a much older framework. It was first released by DHH in 2004 for his company Basecamp. Laravel was not created until 2011 when Taylor Otwell released it to solve problems that plagued existing PHP frameworks. Laravel has rocketed in popularity in recent years while Rails has decreased in popularity (according to Google Trends).
Both frameworks are actively maintained and updated. Laravel and Ruby On Rails each had their fifth major release (version 5.0.0) this past summer.
For companies and developers deciding between the two frameworks it is a choice between the older, tried and tested software versus the relatively new kid on the block.
Ruby is decried for being slow. PHP is feared to be messy and unmaintainable. These are the common critiques of the languages themselves.
Ruby is not as fast as other programming languages. Twitter experienced issues with Ruby On Rails in its very early days for processing millions of requests per second during peak hours. It is important to note though that the language has increased its speed dramatically from 2004 to 2016. Additionally, there are Ruby tools out there to increase scalability such as Chef with AWS and Capistrano (among others) to increase performance. DHH wrote a great post called Ruby has been fast enough for 13 years outlining his position.
PHP on the other hand has been around since the very beginning of the web in the early 1990s. Facebook is built on PHP and has invested heavily in its ongoing development. PHP has a bad wrap especially among older developers because PHP frameworks used to be a complete mess. There was not a central way to manage dependencies. Ruby has gems, Node.js has npm, Python has pip, Java has Mavenand PHP did not have this system until 2012.
The PHP development landscape changed with the release of Composer. Developers could now use individual packages and mix and match instead of relying on one monolithic PHP framework to handle all of their problems. Composer is required for modern versions of Laravel.
Both frameworks have surged in popularity because of their accessibility. Ruby On Rails has RailsCasts. Laravel has Laracasts. Both have many free videos but require subscriptions for unblocked access.
Rails has been around for longer and more has been written about it. Laravel is growing faster and the community is smaller but more active. There are no shortage of free resources online for learning either framework.
Which framework are you using? Please feel free to respond in the comments!
Originally published on Medium