DEV Community

Cover image for PHP or Ruby on Rails – Which One To Pick Your Next Web Product?
Ideamotive
Ideamotive

Posted on • Updated on • Originally published at ideamotive.co

PHP or Ruby on Rails – Which One To Pick Your Next Web Product?

A venerable veteran or a prodigy? PHP or Ruby on Rails – which one to pick for a web development? Answer is not that obvious.

When it comes to internet development there were two technologies that had transferred static webpages done in sturdy HTML into the interactive multimedia tech of today. First one is JavaScript, enabling the user to polish a frontend of the solution. The second one is the PHP, that stands somewhere in between the frontend and the backend, standing behind the power of most popular solutions including WordPress and Magento.

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
PHP has a strong background as a tool to connect websites with databases. It was not designed to make the webpage shine, but to enable the user to access a vast array of content. It works well when it comes to that, but to deliver an astonishing user experience it needs to be supported with additional technologies like JavaScript.

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. And that’s the case.

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.

Summary:
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?

Originally published at https://ideamotive.co/blog/php-vs-ruby-on-rails

Top comments (3)

Collapse
 
david_j_eddy profile image
David J Eddy • Edited

Sorry for the wall of text, but there are some way glaring issues with the above comparison.

  • "...somewhere in between the frontend and the backend..." - PHP runs on the server side, thus it is a backend language. Ruby runs on the server side, thus is it ALSO a backend language. Both can use HTML/JS/CSS for front end rendering.

  • PHP is still VERY relevant in 2019. In fact, minor updates every 6 months with V8 planned for Q4 20200 ttps://en.wikipedia.org/wiki/PHP#Release_history

  • Symphony, Laravel, Yii, Cake, Zend; PHP has many active frameworks to choose from. As does Ruby.

  • RoR is inspired by software design patterns, oh look, so it every major framework ever.

  • "...The technology imposes numerous good practices including DRY (Don’t Repeat Yourself) that encourages developers to reuse blocks of code..." DRY, MVC, etc are patterns that nearly every language and framework follow. This does not make RoR special in any way.

  • "...Convention over Configuration..." Nope. Ruby does nothing to enforce this pattern. Rails, the framework, encourages this due to the design pattern that inspires it's architecture.

  • "...PHP is a script language ..." Partially true. Since 5.4 PHP has been, and continues to grow as, a full Object Oriented Programming language. Saying it is a scripting language is like say Javascript is ONLY a scripting language. BASH is a scripting language, zShell is a scripting language. PHP/Ruby are not.

  • Websites that "use" PHP: FB, Yahoo, Wikipedia, Wordpress, Tumblr, MailChimp, flicker, Esty (the creator of PHP actually works there now), Baidu, etc. However, do NOT make a language selection based on other success. Every single one of those listed also use other languages. Just like every single RoR application uses other languages as well.

  • "...Due to PHP legacy, most popular frameworks are making coding more complicated..." Uninformed falsehood. Modern frameworks actually make it easier to be productive. Just like RoR understanding design patterns is important.

  • "...Ruby on Rails is known for delivering shining and polished websites that enhance the user experience..." ... by using Bootstrap, jQuery, and numerous other FRONT end libraries and tools. Again, just like any other modern framework. The comparison is obviously biased and unbalanced.

  • "...PHP, as mentioned above, is usually used saute, with every developer building own stack of technologies..." Blatantly untrue.

  • As for performance, you are correct here. Comparing RoR w/ PHP is not a fair comparison...so lets do PHP vs Ruby if you want to base business decision on raw benchmarks (a terrible idea btw): benchmarksgame-team.pages.debian.n...
    PHP wins. Given that PHP has nearly TRIPLED in speed between the 5.6 and 7.4 releases. Ruby has been on 2.x since 2013.

  • "...PHP being around since 1995..." Yep, PHP is an entire decade older than RoR, but once again look at the language, not the framework. Ruby's 1.x release was December 25, 1996. Only 1.5 years after PHP... yet it was not until RoR that Ruby gained any traction; why is that?

  • "...It means bot[h] freedom to create or to destroy..." With great power comes great responsibility. - Uncle Ben

  • "...PHP [i]n contrast comes with documentation designed in 1995..." Ok, that's true. :D The official docs (php.net) design is dated. Personal feeling here, it is easier to read than the RoR docs. But that is a personal bias.

  • "...So if the problem is totally standard with no perspectives to be tweaked in any way, PHP can be a good choice..." That reads like PHP is not a good choice otherwise. I have to respectfully disagree. From ocean cruise liners navigation systems to high volume medical records systems. PHP has done, and done well, a wide range of roles

  • "...But if you look for something more sophisticated, the tech from previous millennium can be a risky choice..." What will you suggest next? Piping logs to /dev/null? If you / your boss / your customers have money, lives, safety at risk and the system MUST work, and work forever, sometimes last millenniums tech is a better bet.

While your article makes some valid points, it has massive flaws and gaps in knowledge. It reads more as an opinion piece comparing apples to oranges and you prefer apples. Don't get me wrong I welcome comparisons; but this is very nearly an opinion piece.

I say all that to say this: at the end of the day the language / framework you pick is not important. Having educated, eager, learning people who will continue to grow there skills is more important. When all you have is a hammer, everything looks like a nail; but when you have a tool belt, jobs get done quicker and correctly. - DJE

Collapse
 
ideamotive_co profile image
Ideamotive

Hi David! Thank you for your valuable comment. I've passed it on to the right person to make corrections to make the article more useful.

Collapse
 
yogeswaran79 profile image
Yogeswaran

Hey there! I shared your article here t.me/theprogrammersclub and check out the group if you haven't already!