Micro frameworks in PHP

Micro frameworks in PHP

I began a new project recently that will replace an existing web application written using a heavy-weight Model View Controller (MVC) framework with a much lighter solution, which will be built around a light-weight "micro" framework.

The only mandated requirements I had for choosing this framework is that it be simple to use and robust, and be implemented in PHP. As you may already know, I am the developer of the Alpha Framework which is a heavy-weight full-stack PHP MVC framework, so the micro framework approach is something of a new departure for me.

I must admit to being very impressed with the work that is being carried out in this area by many talented PHP developers. If anything, the difficulty I had in choosing a suitable micro framework for our needs is that there are too many options.

In the end, I have chosen Silex due to the following reasons:

  • It is being actively developed by the same people who produced the excellent Symfony framework, and comes with a bridge into that framework in case we need more functionality than Silex on it's own can provide.
  • It has a dependency injection interface, which is useful for us as we plan to inject in non-Silex services for caching, logging, and data persistence.
  • It has a nice, clean API for routing controllers, although frankly the same could be said for each of the other micro PHP frameworks we looked at.

While I am still a big fan of the full-stack approach of frameworks like Alpha, I also believe that for some projects a micro framework like Silex has a lot to offer, and I look forward to using this framework on our new project in the months ahead.

John Collins

I have been writing about web technology and software development since 2001. I am the developer of the Alpha Framework for PHP. I love open source, technology, and economics. You can follow updates from this blog on Twitter.