Back to PHP

My current project with Sourcepad is converting a web application with with Drupal to CakePHP. We opted to develop the application with Ruby on Rails but the client wanted it developed in PHP. I would have loved to develop something again in Rails but clients can be persuasive (really persuasive).

With PHP, we had a few choices. We could develop the application using CakePHP, CodeIgniter, Yii or Kohana, frameworks I have had much experience in.

We ended up using CakePHP by writing up pros and cons for CakePHP and CodeIgniter. Yii and Kohana would have been very fine options but my project partner has little experience with them. 

Here's a list of what we had:

  • ( - ) Slow
  • ( + ) Built in themes
  • ( + ) Rails-like relationships
  • ( + ) Better Integration with Testing Suite(PHPUnit)
  • ( +/- ) Convention over Configuration
  • ( + ) Harder to mess up code because of stricter conventions
  • ( + ) Solid performance from the start
  • ( - ) No built in themes
  • ( - ) No ORM
  • ( - ) Built in Unit Test Class is weak
  • ( - ) Can potentially become hard to manage
  • ( +/- ) Configuration over Convention (somehow) 
People can of course argue that there are extensions for the CodeIgniter framework and CakePHP would be just as fast with proper caching.

The CakePHP and CodeIgniter frameworks are great. I've used both extensively (especially CodeIgniter). The thing is, in the end, we didn't choose because of the pros and cons(although CakePHP won). It will be team experience that will affect the framework decision. Only I had experience developing using the CodeIgniter framework, so we chose CakePHP.

Haha. Problem solved!

 Handy Shortcuts Using RubyMine

I have been an avid fan of RubyMine ever since I discovered it. I tried using other tools like Sublime Text 2, Textwrangler and others. The only other lasting editor I used was Vim on my Ubuntu Desktop and MacVim on my Mac.

There are tons of things I miss from Rubymine whenever I develop using other editors. Here are a few:
  1. Image Preview - Do you want to make sure you have the correct image to use in your CSS? Hover over the declaration and press Shift.
  2. Insane Code Inspection - Rubymine helps you be aware of deprecated methods, unneeded methods and overridden methods. 
  3. Checking of Source - A great feature I like about it is Command-clicking. Whenever I am not sure what a method does, I Command-click the method and I am instantly forwarded to the method declaration. This is quite handy if you want to check gem sources.
Here are a few shortcuts I have been using with Rubymine in the span of a year I have been using it. I really hope this helps Rubymine users like myself to ease up development and trim development time.

Joining lines (Shift + Ctrl + J)

I never had the idea that there was such a function in editors. I discovered this when I thought of a way to join lines instead of doing a backspace on every line in a 100+ line file.

Toggle Comments (Command + /)

This will be very familiar since this is used  by Textmate and Sublime Text. It will comment depending on which type of file you have open.

Show / Hide Project Folder (Command + 1)

I work mostly on a small 13" laptop and I need all the space I can get. The project pane can easily be hidden so that I can use up the the full length of my small screen.

 Rewriting FoodScaper

FoodScaper is Social Networking website dedicated for restaurant and food enthusiasts.

After a couple of months of developing our website, we launched FoodScaper. FoodScaper launched due to our need to discover restaurants and menus in greater Manila.

I have been a Ruby on Rails developer for more than 2 years now. Most projects I have worked with was coded in Ruby on Rails 2.3 to  3.x. I code PHP on the side and sometimes if there is a need for a PHP developer, I was the one called upon to handle the project.

I have chosen to rewrite most of FoodScaper from Ruby on Rails to PHP.

PHP is a good language. I would be first to admit that are there a lot of downs in the PHP language. The thing is that it does the job fine. This can be said for most languages.

While I coding FoodScaper, I have missed a lot of testing tools from the Ruby community:
  • RSpec
  • Cucumber
  • Capybara
To my knowledge, PHPUnit is the best testing tool in the PHP community and I feel there is an immediate need to have more just unit testing here.

However, the cost of deploying a Ruby on Rails website is really what got me rewriting FoodScaper to PHP. As of now, an instance from Webbynode or Linode with an allotted 500MB memory costs around 20USD per month. My host right now could handle FoodScaper and a few more websites without running out of memory.

In the end it was cost. I know about the phrase, "Developers are more expensive than hardware". The thing is, right now, I am both the developer and the one paying. 

I believe FoodScaper is going to be a great website and having a good language (not the best) by my side is the best option for me. I’m going to try really hard to make it successful, and I felt in order to do that I need to at least sustain it and pipeline costs to marketing.

 Exploring Microframeworks

I have been recently playing with the microframeworks, Silex and Slim, the full stack framework, CakePHP and the relatively cool framework that is Yii for several projects. I admit that exploring these frameworks, especially Silex and Slim, have been awesome experiences and I intend to learn these frameworks to grow my skills.

My frameworks of choice have always been either Kohana which I have worked since version 2.3.4 to 3.0 and CodeIgniter from versions 1.6.1 to 2.1.3. I have used CakePHP and Yii for some projects but I never really grasped the ideas behind CakePHP until I now. Yii, just like CakePHP is a full stack framework but is much easier to learn than CakePHP. This is probably is the real reason(not because CakePHP is slow) why Yii is being advocated by a lot of PHP developers today.


Silex is a microframework that I have reading and learning about in the last few days. My first impression was that Silex is nothing more than a routing framework and glue framework. With Silex you will decide how to structure your application. While you may find some Silex applications with the same structure, there will be just be a few as compared to applications built with CakePHP, CodeIgniter, Yii and the others which enforces / favors structure and convention.


Along with Silex, I have been using Slim, a micro framework developed by Josh Lockhart. So far, I have been liking this better than Silex. The two microframeworks have almost the same concepts. The following reason are why I like Slim better:

Silex also doesn't have a way to render php files out of the box. You would need to create your Output Control implementation to do this or use Twig, which is very much supported by Silex. In my case, I like flexibility. I need not learn another templating engine to use Slim. With Slim, you can use Twig or any templating engine you want but also use plain old PHP files as view files.

Silex makes heavy use of Symfony Components. Silex could get complex pretty quickly.

Take note that Silex's heavy use of Symfony components is not a bad thing. With Silex, you won't be scouring the internet for how to integrate Twig, Swiftmailer, Form Validation and many others. Symfony components can easily be integrated to Symfony which makes it a more `complete` framework than Slim.

As I finish typing, I just deployed the Slim framework version of my application.