A Small Intro..
Have you ever tried to use Slim PHP micro framework? Or you are in a confusion whether to choose it or not? Well, today I bring you a small chat with Jeremy Kendall [@jeremykendall] who’s been using Slim PHP for quite some time now and he is even using it on his side open-source project as you will discover.
Jeremy has previously been giving a nice talk about Slim PHP Microframework last year in November at Tech Camp Memphis, you can view the Youtube video here! Also worth noting, he has recently delivered another Slim talk (some 6 months back at the time of this writing) at the recent php[tek]2013, you can view his slideshare talk here => Keeping it small – Getting to know the Slim PHP micro framework!
Have You Tasted Slim PHP Micro Framework? Jeremy Kendall Shares His Opinion On It!
>> Hi Jeremy, please tell us a bit about yourself
My name is Jeremy Kendall, I’m from Memphis, TN, and I’ve been developing web applications in PHP since 2001. By day I work for OpenSky.com, building an amazing social shopping platform using Symfony2, Doctrine, MongoDB, and MySQL. By night I divide my small amounts of free time between my passion for programming in PHP and learning more about my craft, helping others learn more about programming, contributing to open source projects and building a few of my own, spending time with my amazing wife Megan, pursuing my favorite hobby, photography, and preparing for the birth of our firstborn.
>> Have you ever tried Slim PHP Framework?
Yes, I have tried the Slim PHP framework. My interest in micro frameworks was piqued by Ed Finkler‘s MicroPHP Manifesto (http://funkatron.com/posts/the-microphp-manifesto.html) in January of 2012. Most of my experience with frameworks prior to that time had been Zend Framework 1, which I used heavily at a previous job, followed by years in the wilderness working as a solo developer on terrifying legacy PHP code. I did the smallest amount of research on microframeworks, chose Slim because it felt both very micro and mature enough to commit time to, and started building. The result is the Flaming Archer project (https://github.com/jeremykendall/flaming-archer), the Slim PHP codebase that runs my photo-a-day project at http://365.jeremykendall.net.
>> What is your opinion about this framework?
I really like the Slim framework. What I’ve found in Slim matches my concepts of what a microframework should be: It’s narrowly focused, the code is clean, clear, and concise, and it gives me the few tools I need to write a web app. Beyond handling requests, responses, and routing, I’m pretty much on my own to build whatever I need however I like. I’ve never felt like Slim has gotten in my way.
>> Do you think the author, Josh, made a good job with Slim PHP?
I think Josh had done an amazing job with Slim. I’m a big fan of best practices in general and a big fan of unit testing and coding standards in specific. One of the things that drew me to Slim was the test coverage and the adherence to a coding standard, in this case PSR-2. Josh has also done an excellent job limiting scope creep, which can be really tough to do.
>> Aspects where you think Slim PHP could improve on..
My major points of contention are either fixed at this point or being worked on. That said, logging has always been a weak point in Slim, and it’s arguably something that doesn’t really belong in a microframework. There’s been some recent back and forth about the logger, and I’m happy to say that it’s slated for removal. I’d also like to see a lot more interfaces in the framework, and I noticed a PR the other day with a nice collection of interfaces.
>> Aspects where you think Slim rocks..
There are quite a few places where Slim really shines. I love the middleware implementation and how easy it is to quickly whip up a class that can inspect and modify requests and responses. I’ve been able to do cool things with authentication and navigation that way.
I recently started using the custom error handling provided by Slim. I was able to rip out multiple redundant lines of error handling code and replace it with a single, three line anonymous function. I was seriously impressed.
>> Is Slim PHP better than Silex – why slim over silex for your choice of a micro framework?
Short answer: Choose the right tool for the job.
Long answer:
I really can’t say whether or not Slim is better than Silex or vice versa. The vast majority of my microframework experience has been with Slim, so I don’t think it would be right for me to offer an objective opinion. My subject opinion, however, is that I much prefer Slim to Silex. That opinion is based on running through a few tutorials when I was trying to pick my first microframework. The Silex tutorial was full of: “and now pull in this Symfony2 component“. Silex didn’t match my conception of what a microframework should be, and so I chose to go with Slim.
That said, once my Slim Framework based photo-a-day application is feature complete, I’ll be reimplementing it in multiple different frameworks, one of which will be Silex. I’ll have a better answer for you in a couple of months.
>> Would you choose Slim PHP over frameworks like Symfony or Zend?
That depends entirely on the project I’m starting. My photo-a-day project was the perfect size and scope for a microframework, and building it out with Slim has been a joy. I haven’t once wished I’d chosen something larger or different to build my application with. A full-stack MVC framework would have been serious overkill.
Trying to run something like OpenSky.com on Slim would have been a very poor choice, however. The complexity and size of the application really lends itself to a full-stack framework, and Symfony2 really fits the bill.
- Would I lean towards Slim when starting a project? Absolutely.
- Would I fight for Slim when another solution looks better for the task at hand? Not at all.
>> Any message to Josh?
Keep up the good work!
>> I’ve heard you are writing a book on Slim PHP? 🙂
That was supposed to be Top Secret! You must have excellent sources. All I’m willing to say that this point is a book is in the works. When the time comes, we’ll talk again.
If You Appreciate What I Do Here On Seven PHP :: 7PHP, You Could Consider:
- LIKE-ing 7PHP dot COM on FaceBook
- Help diffuse this interview to the PHP ecosystem – Share, tweet and spread the word to your audience ==> That would be a FREE way to thank me
- Make a comment below using the comment form
{I’m thankful to your response(s)!}
Look forward to the book on Slim!