Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

A Look at Silex: A Symfony2-based PHP Microframework

DZone's Guide to

A Look at Silex: A Symfony2-based PHP Microframework

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

 Microframeworks are a trending topic in PHP land right now, and a usage good example is now online for the Silex microframework along with some great advice on when to use microframeworks in general. Recently Stefan Koopmanschap, a major voice in the PHP community, took a dive into the Silex microframework and created a simple URL shortener with it:

Contrary to most other microframeworks, however, Silex is built on top of an existing open source project: Symfony2. A microframework is a very small framework which basically does nothing more than bootstrap and handle your request and response. Though the microframeworks cater to a very specific need, I really like the approach of not needing a full framework for a project that clearly is simple enough not to need one.

Some things I really like about Silex are:

  • Built on top of existing open source components
  • Packaged in a phar package
  • Extensible: There are extensions available to the Silex core, and I can extend it even more
-- Stefan Koopmanschap

Using Silex, Stefan found a lightweight approach to getting his simple application up and running in a couple of hours by just coding and improving in small steps.

What I've found is that Silex (or any other microframework for that matter) is an excellent approach for small projects where you start with an idea of what you want to build and then improve on your existing code. It is very tempting to put in hackish solutions, which is OK if you keep on improving  -- Stefan Koopmanschap

Stefan says that microframeworks are also useful for application prototyping.  Their simplicity helps you prototype very quickly.

Source:  http://www.leftontheweb.com/message/A_URL_shortener_in_a_couple_of_hours

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}