A venerable veteran or a prodigy? PHP or Ruby on Rails – which one to pick for a web development? Answer is not that obvious.
But is one of the most renowned technologies still relevant in 2019? Can it stand comparison with modern languages and frameworks like Ruby on Rails?
What is Ruby on Rails
Ruby on Rails is a framework for Ruby language designed to make coding easier, faster and more convenient for web developers. The technology imposes numerous good practices including DRY (Don’t Repeat Yourself) that encourages developers to reuse blocks of code.
Also, the tool follows the Convention over Configuration path, enabling developers to minimize the configuration work by proposing a predefined environment.
Ruby on Rails is one of the most popular technologies in the world, powering over 824 thousands of websites out there. It was included on the list of 20 most popular technologies in the world delivered by TIOBE Index and ranked 13th on StackOverflow’s ranking of the most popular programming languages. And there are many awesome websites using this technology.
What is PHP
PHP is a script language designed to deliver websites and web apps in real time. It is one of the most renowned technologies in the web, used by 79% of all websites existing. PHP powers up popular open source solutions with WordPress and Magento being among the most popular ones. Facebook was initially delivered in PHP and later on translated to C++.
Fun fact about PHP is that every year commentator and experts debate on if the language is dead or is going to be dead soon. But this time PHP has a lot of in common with Mark Twain, as the report on its death is an exaggeration.
Why should we compare them?
In fact, comparing PHP with Ruby on Rails is not that fair. PHP is a programming language, while Ruby on Rails is a framework. So it would be much fairer to compare RoR with some PHP framework, be that Zend or Symfony2.
But not really when it comes to PHP programming. Most developers prefer to cherry-pick own set of libraries and plugins to leverage in their project, effectively creating own framework. Due to PHP legacy, most popular frameworks are making coding more complicated, not less as in case of Ruby on Rails web development framework. So in fact building, a comparison done on framework vs. framework basis would be inherently flawed.
So how those technologies perform when compared?
Ruby on Rails vs PHP – User Interface
Ruby on Rails is known for delivering shining and polished websites that enhance the user experience. It is a modern technology, born after the UX principles and fully backing building the user-centric websites.
Verdict: Ruby on Rails outruns PHP. Double time.
Ruby on Rails vs PHP – Architecture
Ruby on Rails is praised for adopting the Model-View-Controller paradigm, effectively forcing the user to follow the best practices on building apps. Thus, when the user properly, the framework comes with well-performing and stable architecture.
PHP, as mentioned above, is usually used saute, with every developer building own stack of technologies. it gives freedom – including the freedom to deliver messy code and unstable architecture. The quality depends only on the skills of the developer.
Verdict: So again, Ruby on Rails vastly outperforms PHP.
Ruby on Rails vs PHP – Speed of coding
With DRY principle and Convention over configuration forced, Ruby on Rails web development enables developers to do what is best at – coding. It cuts off a lot of time usually wasted for mundane work of configuration and delivering a programming environment.
PHP again usually comes to saute, with no tools to speed up configuration or any other aspect. So the language, despite being relatively easy, can provide a headache during the implementation of the end solution.
Verdict: sorry, PHP. Not this time
Ruby on Rails vs PHP – Performance
Ruby on Rails is fast and elegant. It delivers good-performing code backed by good programming practices and reliable architecture.
PHP is a programming language, so it is hard to determine if its performance is better than RoR. With full freedom to deliver marvelous (or crappy) code.
But assuming that there are only development stars on board, PHP outperforms Ruby on Rails. But to be honest – are there? It is not that easy to find a star, no matter if you are looking for Ruby on Rails web developer or PHP coder.
Verdict: PHP. But only when done well
Ruby on Rails vs PHP – Community & support
PHP is renowned, venerable, rustproof and unsinkable. Considering that, there is a strong demand for PHP coders. Also, with PHP being around since 1995 there is a gargantuan library of tricks, Q&As, and already solved problems. Moreover, there are numerous PHP developers on GitHub or Stack Overflow to help both on the language itself and particular technologies like WordPress or Magento.
Ruby on Rails is much younger technology, yet already mature, with a thriving community. But there is no way to outrun the experiences gained since 1995.
Verdict: PHP. Sometimes nothing beats experience.
Ruby on Rails vs PHP – Stability
With MVC and DRY paradigms forced, Ruby on Rails delivers little to no issues with stability. By reusing blocks of code, developers ensure there are no hidden dependencies or hardcoded info that should have been inserted as a variable.
With PHP there is total freedom. It means bot freedom to create or to destroy. With no imposed rules but the programmer skills, the stability heavily depends on the coder’s skills. That can mean anything – from total unbreakability to a minefield.
Verdict: RoR delivers some level of stability for granted. PHP is ranged from “unbreakable” to “snowflake”. When approaching an unknown land, Ruby on Rails seems to be a better pick.
Ruby on Rails vs PHP – Documentation
Ruby on Rails comes with clear, legible and logical documentation, that supports Ruby on Rails programmers on every aspect of their job.
PHP on contrast comes with documentation designed in 1995, the pre-good-practices era. Sometimes riddled or inconsistent, usually omitted due to extensive help available in the Internet.
Verdict: Ruby comes with better documentation. PHP lacks one, but does it really matter this time?
Ruby on Rails vs PHP – The maturity of the platform
Ruby on Rails is one of these technologies that are mature enough to get rid of teething problems yet modern enough to be compatible with the newest trends.
And when talking about PHP – is that an issue? Really?
Verdict: PHP. Maybe Fortran is more mature out there.
When to use PHP?
PHP is currently the most popular web language. Its popularity comes from a vast amount of open source software using it. So if the problem is totally standard with no perspectives to be tweaked in any way, PHP can be a good choice. A totally standard blog can be run on WordPress with no doubt in the same manner as e-commerce can be supported by Magento.
But if you look for something more sophisticated, the tech from previous millennium can be a risky choice.
When to use Ruby on Rails?
Ruby on Rails development is a mature and stable technology to support more sophisticated solutions. Moreover, as a web-centric framework, RoR enables companies not only to digitize but to augment business processes with new possibilities. When the company needs something more than “standard” or “typical” solution, Ruby on Rails is a better pick, especially when you need some sophisticated e-commerce product or SaaS product.
To be honest – would you like your company to be “typical” and “standard” one?