I can hear the Rails purists slicing open the soft flesh of their vitamin D-less wrists now. Are you crazy? PHP sucks, lets all build applications using Ruby on Rails because it is after all the better language right? This is not a language debate, this isn’t about one language being better than the other.
Recently I’ve had this obsession with browsing through various RoR projects on Github and came to a realistion about a week ago. The Codeigniter PHP framework which I am an avid user of (as most of you know) is based on the same kind of structure as Ruby on Rails, so I got to thinking — why not learn other RoR projects?
Building a Twitter clone in PHP? Checkout one of the countless Twitter clones done in Rails because that’s what the actual Twitter is built in and people wanted to see if they could replicate the site. Not only do you get to see what controllers and models you need to have (some don’t apply), but you also get the value added of being able to see the database schema (creating a proper database schema is something a lot of people fail at). Database architecture is hard.
Want to see how you should map out a database for a Facebook like social network? Checkout the database schema of Diaspora — although databases are interacted with somewhat differently in Rails compared to Codeigniter, you can see what goes into mapping the database and then check out the controllers and models to see what else makes up the site.
This approach goes for any language application, Rails is similar to Codeigniter so I believe it’s an easier choice if you’re wanting to see how something is done.