If you've worked with Ruby/Rails, what is the reason to stay with PHP?

So I notice some of you guys use Ruby/Rails, may I know what is the reason for you to still work with PHP? hope nobody find this offensive :lol:

What do you mean ‘still work with PHP’ ? <_<

The amount of hype surrounding the RoR and Git camp is just utterly ridiculous.

Ruby on Rails was actually what led me, indirectly, to Yii:

The project I was involved with took a fancy to Redmine issue tracker, but we grew tired of having to run RoR on our shared host, so I decided to write Redmine using PHP.

I picked CakePHP as that was the closest to RoR I could manage to find.

Still it was a beast, and I needed to rewrite it. And came to Yii. :)

So, PHP and Mercurial for me.

For level headed practical pragmatics who doesn’t care what’s hot right now. ;)

Alright: Ruby as a language - and that’s the only fair comparison here - is a neat language. Don’t get me wrong.

Deciding to make it run as a language for the web, I am not so sure…

It’s just like Python… Unnattural.

The raw performance of PHP - compared to those languages/implementations - kicks some serious …

PHP grew from Perl/CGI and is thus much more native.

But, let’s celebrate the diversity. :lol:

I like PHP very much.

Probably because I am a C++ programmer as well.

@jacmoe thanks for your reply! ‘still work with PHP’ because I see most of the people working using Rails were working with PHP before that, and swear they will never go back to PHP :lol: so that is one of the reason I ask :)

I developed on my own php framework for about 10 years. Two years ago, I started using RoR. My employer uses RoR, so I use it about 40 hours a week. I’ve done several other projects in it. The main reason I’m going back to PHP is the ease of hosting and deployment. Yii gives me much of the nice architecture I have grown accustomed to with Rails and it just feels more lightweight and speedy… I ever have to “reboot my server” to get something going… I swear I spend at least an hour a day waiting for things when I’m developing on Rails. With PHP, it’s just edit refresh edit refresh. RoR generally requires a specialized host ($$$) and you pretty much can’t develop on a PC. PHP is everywhere and cheap… perfect for rapid prototyping. I’ve done a few RoR apps for small clients and have realized it’s not as easy for them to maintain after I leave as PHP apps are. I think RoR is a great choice for startups with teams of developers. However, dev shops that don’t provide hosting should probably go with PHP. Yii gives me the best of both worlds. I’m right now putting together a development stack for PHP… I want to use Yii with HAML/SASS, GIT version control and some sort of automated deployment from a git repository (which I’m looking for now). Also, I may revise this after some more experience with Yii… already I’m questioning the lack of support for RESTful resources. But I’m pretty excited to dive in and give it a spin.

Thanks for the feedback! I agree with you on the part where PHP is more suitable for small clients that maintain the app themselves, and with Rails one need to have a dev team running it. However language wise, like what jacmoe mentioned and IMHO is a prettier and neater language than PHP.

You’re right that with RoR needs to be developed in a *nix, and for that I thank RoR else I won’t be using Ubuntu and became accustomed to it since 5 years ago till now. Rails also the reason why I came to use Git.

RESTful resources is in Yii’s roadmap, it is just not here yet, in the core at least. If you check the roadmap it is scheduled at version 1.1.7, but for now you have to roll your own, I’ve read some people did this from the forum.

http://www.yiiframework.com/forum/index.php?/topic/12216-create-rest-web-service/

http://code.google.com/p/yii/issues/detail?id=802&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Stars%20Summary

Coming back to the topic, Rails certainly is one of the leading community that influence many others with new way of making websites, IMHO, of course.

Yes, it certainly is nice to develop on Ubuntu and OSX. I also agree that ruby is prettier than PHP. I just loathe the overhead of running a server for a web application. Yii/PHP are blazingly fast because of caching and lazy loading, and I think that is about right for most web applications these days.

I am, though, wondering about the lack of reflection… it seems Yii is taking the approach of generating code with Gii… which is difficult to maintain. Anyway… I’m getting ahead of myself as I’m just now getting into the guts of an application.

It feels like Ruby/Rails has peaked…the hotter new scripting language is Python. But good old PHP gets the job done, and there’s a ton of innovation too-- Yii and Facebook’s HipHop project and more.

Here’s an interesting read on the topic, from a programming switching back from Ruby to PHP.

OK I’m new and can’t post links, but here’s the partial link. oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

@Chris11 thanks for your thoughts! IMHO Rails still gets a lot of attention with Rails 3, Python is as usual with Django as the most popular web framework.

@Chris11

Note that you posted an article that was written on September, 22 [size="2"]2007[/size].

I found python to be very natural actually D: My company’s intranet server running Windows kind of prevent me from really using Ruby so I can’t compare on that.

I spent about a week each playing with Django and Web2py and I liked them very much. But once I tried Yii… Yii got me all excited the way no other framework got me before.

I still like Python as a language and for my linux maintenance script I’m doing it all in Python now.

@jpenguin Thanks for your reply! May I know which area in Yii got you excited over other frameworks, for example, django/web2py? just curious :)

Still during my first 3 days playing with Yii. Maybe a beginner’s point of view, but here’s what I feel.

  • Web2py, you create the models and web2py will generate database tables for you (they call it migration). It was amazing when I first tried it out, but after trying Yii, I realized I enjoy creating my own SQL tables much more than having it automated. I especially like how Yii emphasize my table relationship I defined with mySQL.

  • login account typed right in the config file… Yes this is not what I’ll do in my final website obviously, but it gives me very good impression that authorization system will be very easy to understand. I can’t confirm this yet, haven’t gotten to authorization yet :)

  • built in jquery and ui.

  • Great, great, great first impression. I think I followed Larry’s tutorial for less than 10 minutes and I was customizing my page already.

  • The above isn’t exactly a Yii thing I guess, because it took me 2-3 days before I can even get python frameworks up and running correctly. So I was quite frustrated to begin with. I often got error messages working with django/web2py that, when asked in their community, turned out I was missing certain python components (that are not exactly easy to find windows version). The way they answered me, I felt were a little… hostile. Like they expected me to know those components already.

  • In contrast to Yii’s IRC, which is -the- friendliest and most helpful out of all the communities I’ve joined.

  • I had to give credit to web2py’s very intuitive syntax tho. Very short, easy and intuitive. For example

in the controller


form = FORM( 

         Field(....),

         Field(....),

        )

in the view


{{=form}}

I would not say putting forms in the controller is very intuitive. The syntax is short but having it in the controller is wrong I think.

I’ve had the displeasure of working with someone who went from php to RoR. It’s like watching a apple fanboy, generally a lot of hype but not a lot of substance. Rails has things going for it but a RoR developer will have you believe PHP is dead and nothing you do in RoR can be done in php, the only way forward is RoR because “its so much faster”, “its so much easier”. None of those are true, while RoR isn’t all bad my explanation is basically a programming language with a framework which happens to have become a standard. PHP has lots of diversity with lots of different ways of doing things and lots of frameworks so its hard to compare RoR features to one.

Gems are the same as pecl libraries before anyone brings that up, I also prefer php syntax to ruby. I’ll leave you with a quick conversation I’ve had before with a RoR developer:

RoRRobot: Hey dude you seen this, it’s so cool

Normal person: what is?

RoRRobot: It’s a API gem for RoR

Normal Person: hows it work

RoRRobot: basically I just need to run this… wait need to download this gem first… ok got that, crap wait need another gem… done. Right now I just need to open up shell and run this command… erm… wait… … Oh yea need to restart this. Right now I can run this command… oh wait need to run another one before that… and this… and that… right just need to type api…connect… SEE!

Normal Person: dude couldn’t you have just downloaded the php version, done a include and hit refresh in your browser?

RoRRobot: yea… but this is RoR so its better! O…O

Could not agree more.

I have not used, and am not planning to use, Ruby and Ruby on Rails because I really don’t like those smug RoR hipster programmers.

I am also favoring Mercurial over Git for exactly the same reasons.

I don’t get this hype, sure it’s a funny little language, but there’s nothing that couldn’t be easily done in PHP, all the new concepts of RoR that are useful, are already adopted by other frameworks.

It’s a good language to do a ‘weblog in 5 minutes’ tutorial, but once you want do something out of the ordinary, you’re in trouble. Same reason I stopped using Drupal…

Using Yii you have the advantages of a mature, stable and well-supported language AND the advantages of newly introduced patterns and concepts…

Well, I’m a Perl guy, so when all this RoR hype has begun I decided to find something similar in perl.

Unfortunately, the only framework for perl was Catalyst, with tons of crap in it. And I coudn’t go with RoR because of hosting limitations.

Then someone told me about RoR-like PHP framework, CakePHP, and I switched to it.

But there were a lot of things that I disliked about Cake, so I began to search for alternative. I’ve tried a couple of frameworks and the only framework that satisfied my needs was Yii.

There are though a couple of things that I dislike about Yii too, but I can live with that :)

Some time ago, I was burnt out, after working hard on one PHP project, and decided to spend a month learning something new. Ruby have nice syntax, and I like it much. RoR is also good, you can develop simple things very fast, but when you need to do something off-road, you are in trouble.

Another thing that is big issue, is to make your scripts that worked locally on production server. Ruby gems also can cause problems due to their dependency.

I want say that Ruby or RoR are bad choice, good masters can work with any tool.

After this trip to Ruby, I back to PHP, and after some time I found Yii framework, and really enjoy coding in it.

I remember, that somewhere I read:

RoR is like a beautiful girl that is a one night stand and PHP is like an ugly wife but who will stick with you in the worst of times.

For those who came from a C++, C#, Java, or similar language, Yii’s abstract interfaces and class hierarchy is appreciated and desired, if not familiar. The hierarchy is so extensible and intuitive, it becomes fairly easy to integrate new bells and whistles, and generally work around PHP omissions to OOP found in other languages. I’m not sure if a ‘beautiful versus ugly’ comparison of Ruby versus PHP or ROR versus Yii is valid.

Probably because development using PHP is somewhat similar or familiar for those of us who come from or continue to use other languages finding their roots in C or C++. PHP continues to be a work in progress as OOP concepts are further integrated and under development by some individuals who migrated over from those other languages. Secondly and you probably have to admit, PHP popularity from an end user standpoint is unusually high for most user audiences because there are a lot more application choices out there on the web.

I only use Ruby with or without ROR when a customer contract demands it, usually for legacy reasons but not always. Thus far and strictly from a income standpoint, I cannot justify using Ruby or Rails for that matter because the income potential is not there compared to the time spent overcoming the learning curve.

Globally, I think some developers (Japan might be an exception because of Ruby’s roots), especially open source developers, might feel more inclined to use PHP over Ruby because of the larger end user audience. Whether you are developing commercial or open source applications, it makes sense to write code for the widest possible user audience.