Building a simple single page application using AngularJS

I am going to walk you through building a SPA (single page application) using AngularJS, Google&#...

Setting up Phalcon on Heroku

Yesterday I blogged about Phalcon, the PHP framework written in C. At the end of the post I said ...

Wednesday, December 5, 2012
Phalcon the PHP framework written in C

Over the past few years the PHP community has matured and evolved immensely The language itself has seen some amazing new features over the past few releases. We now have array literals ($names = ['andrew', 'tom', 'steve'];), function array dereferencing ($first_name = explode(' ', $name)[0];), anonymous functions, closures and traits (similar to mixins). There is composer a package manager similar to npm or bundler and a huge repository Packagist to go along with it.

Although my focus has been on Ruby on Rails and Node.js recently I still use PHP in my day to day work. For the last 5 years CakePHP has been my framework of choice but with the crop of new frameworks emerging I decided I would do some research and see what else is out there.

It seems like Laravel is getting a lot of recognition these days as it rightfully should. It utilizes most of PHP's new features, has amazing documentation, a budding community and a consistent API. All of these features are great but at the end of the day it's not that different from CakePHP which I've already invested over 5 years learning (mastering). The same goes for a bunch of the new frameworks that have either been updated (Symfony 2, Zend Framework 2) or emerged on the scene (Fuel).

Along comes Phalcon

Phalcon is similar in the sense that it is a PHP MVC framework, but what sets it apart is that it's a PHP extension written in C. This has a lot of advantages.


In benchmarks it is shown to be an order of magnitude faster than most popular PHP frameworks out today. This makes sense, since the code is compiled for your system and doesn't have to be interpreted at runtime.

Forget about framework files

Another amazing feature is that all the classes and functions are available to you anytime anywhere. No need to download a 40MB framework every time you want to start up a new project. All of the components are loosely coupled so if you want to write a simple script that just uses Phalcon's ORM classes, just call them like you would any other php functions. No need for includes and managing files.


Installation was a breeze on my MacBook Air. Initially I tried installing via homebrew but that was giving me problems. I ended up following the instructions on their website, restarted my server and away I went.

Creating the extension:

git clone git://
cd cphalcon/build
sudo ./install

Add extension to your php.ini

Restart the webserver


This won't work on most shared hosting accounts since this has to be installed usually at a root level although I wouldn't be surprised if some hosts started adding it to their default installations in the future.

What's next

I plan on writing a few more posts on Phalcon in the next week. Next up will be setting Phalcon up on Heroku. Stay tuned!

Tweet this post if you found it useful

Related Posts

Setting up Phalcon on Heroku

Thursday, December 6, 2012  ·   0

Yesterday I blogged about Phalcon, the PHP framework written in C. At the end of the ... (continued)

Introducing Polytalk. A simple protocol which allows communication between different languages via TCP.

Monday, November 26, 2012  ·   0

Polytalk is my latest open source project. I developed it out of the need to communic... (continued)


Comment successfully added. View comment.×

Comments are now closed for this article.

Jordie · December 5, 2012 01:18AM

Another downside is if there is a bug, and you don't know C, you can just jump in and fix it yourself as a PHP programmer.

Jordie · December 5, 2012 01:19AM

Correction to my last comment: you can't just jump in and fix it yourself.

Andrew Weir · December 5, 2012 01:28AM

@Jordie that is definitely true, although the same goes for most extensions released.

Alpaca · December 5, 2012 10:58PM

Great post!