I find myself in the thick of learning PHP, and I’ve got to admit, I’m having difficulty weaning off Ruby. If you’re in a similar position, you might find the following libraries and tools helpful – with a little less work, you can still build apps the Ruby way.
YAML may just be a textual data format, but using it feels like a very Ruby thing to do, probably because most of us were introduced to it through Rails, where it’s used to describe database connections and test fixtures. Plus it doesn’t hurt that the yaml4r core library makes it dead easy to convert Ruby objects to yaml output.
It’s still good on the PHP side of things. Spyc is a YAML loader/dumper for PHP written by pre-eminent Rubyist Chris Wanstrath. (Coincidence?) Taking a cue from Rails, I’ve used it to configure database connections for a toy PHP app I’m putting together, and it works like a charm.
Update: Looks like we’ll see a Zend-friendly YAML parser soon.
Rake is a build tool whose syntax is pure Ruby. You get all the mechanisms for describing build dependencies ala Make, combined with the flexibility of a fully featured programming language. Most people are introduced to Rake through Rails, but it can be used for anything – even building C programs. The popular Rails deployment tool Capistrano is actually a set of Rakefiles, which can also be used to deploy your PHP application.
Last, but not least, PHP 5 introduced reflection capabilities some time ago. Given the dearth of information available, I don’t think they’re used very much, but if you’ve grown accustomed to polling Ruby objects for their public interfaces, you might want to take a look. Matthew O’Phinney has a good overview of uses for reflection in PHP.
That’s what I’ve come up with so far. Any suggestions? I’ll add them to the list.