Silex Skeleton

I’ve been looking for a good, minimalistic MVC microframework for PHP development for designing RESTful APIs.

I’ve found Silex and I love it because it comes with some bare essentials: A simple dependency injection container and a router. That’s it. Nothing else. Need more? Use Composer to plug in more stuff. This allows me to build powerful webapps and APIs without the overhead of large frameworks like Zend or Symfony where I’ll never use 90% of the features.

Also from a security standpoint: Less code means less attack surface.

I’ve created a skeleton project which serves as project starter template and example on how things work if you’re new to Silex. You can check it out on Github. Once you’ve set it up on your system, you are greeted with a simple demo site:

Silex Demo App Screenshot

Silex Demo App

Apart from Silex itself, the skeleton comes with the bare minimums that I think most people will use frequently:

  • A templating engine: Twig
  • Database access layer: Doctrine ORM
    (The Hibernate for PHP, only way less hassle. Love it!)
  • Support for config files based on an APPLICATION_ENV environment variable
  • Support for internationalization: Symfony translator

And that’s it. These are the bare essentials to building a modern web app. You can of course exchange every part of this by using Composer but I’d like to think that my choices are not unreasonable.

Based on this template, I’ve already developed two APIs for two different commercial projects in just a few days. I’ve never been able to work this quickly and I really really love Silex and I hope you’ll love it too.

Feel free to get startet using my project starter. Pull requests and improvements are always welcome. It is licensed under MIT so go ahead and play with it.