Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Php or Ruby On Rails?

I would love to know which one to learn!! Thank you very much

5 Answers

Stone Preston
Stone Preston
42,016 Points

ruby on rails has a pretty steep learning curve compared to PHP. id start with PHP first then learn Ruby on Rails.

I actually found Ruby on Rails much faster to get, but I was exposed to PHP first; I technically didn't follow along Ruby on Rail's abstractions blind.

I just know I got to CRUD, managing the roles/state of a model , and using sessions for authentication (what I think is the baseline of a backend language) much faster--and with more understanding of how to do it from scratch over and over again--through Rails faster than I got to the same point with PHP.

Thank you so much! I really hope I can do both! But which one has the most functionality and what can i do in php that I cant do with rails?

Hi, Louis:

I'm afraid it's not an easy answer as both have pros and cons that would sway you a particular way depending on what problems you're trying to solve.

It's actually unfair to compare PHP, a language, to a framework such as Ruby on Rails.

Ruby on Rails is an opinionated framework using Ruby and as a result automates a great deal of stuff of you you'd have to do manually if you were using Ruby or PHP by itself.

PHP is a language that has several frameworks such as Laravel, Wordpress, and many more towards achieving similar things towards a web site or web application.

Can you provide me more information about your background with programming in general for me to provide you an honest answer?

I have experience with both, and can do my best to give you an impartial answer. While my preference is Ruby on Rails, my reasons may not be relevant to you at all towards making a sound investment of your time towards creating meaningful things with either.

Time is something you can't get back, so you want to be careful what you spend time learning--especially if the faults of the language or framework sets you back considerably solving the problems you had hoped would be solved by the language or framework.

That said, you may want to try out the introductory courses on both here and other places to see what sticks with you as far as getting into in the meantime.

Firstly thank you so much for the swift answer! If im trying to make a web app with a calendar, mysql database, filtering system, nice visuals and some Jquery animations do you recomment php or Ruby? I didnt quite understand what you meant by framework Kevin. Thank you so much Though!!!

The best way I can explain web frameworks like Ruby on Rails, Wordpress, Laravel, Ghost, and etc is opinionated collection of code and programs that you built on top of.

Frameworks come with default behavior, functions, templates, and even generators already created for you to allow you do common things you'd expect to present and maintain representations of the data relevant to the app you're planning to make.

For example, with Ruby on Rails, it has an opinionated way of how databases should be set up to run a web application to the extent it has an abstract way of dealing with most databases with a class called ActiveRecord. With it, along with handy generators to create new tables via rake, you rarely interact with the databases directly in Ruby on Rails, often saving you a lot of time from writing a lot of code to set up the database, create new tables for your app, and so on.

PHP, by itself, doesn't provide you such benefits. It enables you to do the many things frameworks allow you to do out of the box. Does that make sense? It's like comparing a pre-made Lego Car that's extendable (A Framework) versus creating your own car from scratch with your hands and lego blocks (Languages such as PHP).

As I stated before, there are many frameworks built with PHP such as Laravel and Wordpress.

In your case, you can avoid dealing with PHPAdmin or interacting with MySQL through the command line ,towards managing and creating the instances of calendar your web app would probably require if you were doing it through PHP by itself.

Of course, Frameworks have their cons too. They can be so opinionated how you should do things, they get in the way of the type of web app you're trying to do or have decisions made for you that makes it impossible for you to accomplish the web site or web app you're trying to make.

Also, it does so much opinionated things for you out of the box, it can feel too much like 'magic' to you. It may be really confusing to you why certain things you want to happen for your app aren't working based on your code when the source of the problem is actually an opinionated option (usually configurable) you didn't consider because it was done for you.

Finally, the opinionated way may work for you out of the box, but it may not be the best way of solving your problem. But then again, that's a problem both frameworks and languages can inherit; with languages it's arguably much more findable and solvable than a problem originating from a framework.