Interview: Creator of the Slim PHP Framework

Josh Lockhart saw a void in the PHP community. So, he filled it.

February 6, 2014
Development, Interview, Footer

We have long been proponents of team members spending a portion of their time at NMC to work on side projects they're passionate about.  The policy has been a great success, and we make many of the projects available to other developers, designers, and marketers. You can see a list of some of New Media Campaigns' favorite and most successful side projects here. 

One of the most successful projects is the Slim framework for PHP built by Josh. Josh noticed a void in PHP and decided to fill it by building his own framework. He collaborated not only with NMC'ers but also with programmers around the world to build Slim. Below is an interview with Josh about the idea, its reception, and how it has been put to use. 

Hey there, Josh. Tell us a little about you and your background.

My name is Josh Lockhart (@codeguy on Twitter). I'm an application developer at New Media Campaigns where I build cool things with code. I'm probably best known for writing the Slim Framework (a popular PHP micro framework) which I have open-sourced on GitHub. I'm also recognized for creating and curating PHP The Right Way, a very popular movement in the PHP community to help developers learn modern-day best practices and coding standards.

I'm a self-taught developer, and I have been writing code (primarily PHP) since 2002. PHP and Javascript are my "go-to" languages, but I've always wanted to pick up a new language or two... if only I had the time!

What is Slim?

The Slim Framework is a PHP micro framework that helps PHP developers quickly and easily write web applications and APIs. Think of it as a core set of tools with which a developer can build amazing things.

Slim was a precursor to the popular micro framework movement that took off in 2013 and continues to be a popular ideology today. A "micro" framework is a collection of bare necessities required to build a web application. Typically, a micro framework facilitates receiving an HTTP request, routing the HTTP request to an appropriate controller, dispatching the controller, and returning an HTTP response. Slim takes this a few steps forward and also provides additional tools to manipulate the HTTP response (HTTP caching, status updates, redirects, and so on) as well as a very extensible middleware implementation.

In contrast, many developers are probably more familiar with larger full-stack frameworks like Laravel or Symfony. These excellent frameworks have a larger codebase, more "kitchen-sink" functionality, and a larger learning curve. For some projects, both Laravel and Symfony are great tools. For other projects that do not require the additional overhead, "micro" frameworks are a more appropriate tool for the job. Why use a commercial-grade jack-hammer when a simple (double-sided?) hammer will suffice?

This is the core ideology behind the Slim Framework: prefer simplicity instead of complexity. This maxim applies to Slim's architecture, Slim's source code, and Slim's user-facing feature set.

What other micro PHP frameworks existed at the time? What pushed you to create your own?

When I began writing Slim, there were one or two existing small PHP frameworks, notably Limonade and Fat Free. I glanced at both, but neither met my immediate needs. I was also inspired by Kris Jordan's Recess Framework (no longer developed) although Recess was far more power than I needed. I wanted something simple (like Limonade) but with a bit more structure (but not as much as Fat Free).

So I began writing Slim, and I used that time to improve my knowledge of the HTTP protocol. I was already familiar with the HTTP protocol, of course, but there were plenty of features that I did not know well enough. Writing Slim was a great learning experience (and still is to this day).

Why did you decide to build this framework for PHP and not another language?

I've been coding PHP since 2002. PHP takes a lot of crap from Python, Ruby, and [insert any other language here] developers. And for good reason! PHP is not the most elegant or consistent language, and it can be very quirky to work with. But at the end of the day, PHP is very easy to use and powers a large majority of the web. This was an easy decision for me to make.

How has the reception been to Slim since launch?

Amazing. I had no idea Slim would become so popular. After a week on GitHub, it received a brief mention on GitHub's The Changelog podcast. After that, it has been a fast and steady climb to become one of the top 20 most popular PHP frameworks on GitHub with 3,200+ stars and counting. According to Packagist statistics alone, Slim has been used in over 106,210 projects by numerous developers around the world.

How has Slim affected your own work and what type of projects do you use it for? What are some of your favorite examples of Slim projects or problems it can solve?

I built Slim for myself to build smaller websites and APIs more efficiently. Before I wrote Slim, I found myself "reinventing the wheel", so to speak, far too often. Slim consolidated my most common boilerplate tasks into a simple, easy to use framework.

Slim is wonderful for building APIs that power larger front-end websites. Such APIs may include exposing a remote database as a simpler JSON schema, handling user registration, dispatching emails, running intermittent cron tasks, and more.

Of course, Slim is also wonderful for building smaller web applications. One of my favorite examples is Statamic, a very popular and fast-growing flat-file content management system. Slim also powers GimmeBar, and it was used by Aaron Foss' Nomorobo app to win the national FTC robocall challenge in 2012.

How has it helped you in your day job at NMC? Have you been able to use it for any cool projects with the team?

Slim has been super helpful for building cool things at New Media Campaigns. After all, that’s why I built Slim in the first place. The fact you can install Slim (or a working boilerplate Slim application) means I can have a new Slim app up and running in about 20 seconds. Obviously that saves time right there. At New Media Campaigns, I primarily use Slim to create APIs that expose information from a database as JSON to be used by various front-ends or other remote APIs. I’ve also used Slim to flesh out complete admin control panels, like the one I built for the UAW Gimme5 initiative that lets UAW members log in and record community service hours. So yes, Slim has been a windfall of productivity at New Media Campaigns making project development easier, faster, and — perhaps most importantly — more fun.

What have you learned from the whole experience of building the framework, launching it, and iterating?

Two things.

One: don't be a perfectionist. Write code that works, release, then iterate.

Two: Don't be afraid to say "no". I've turned down lots of great ideas to ensure Slim continues to focus on simplicity and avoid complexity.

What are your goals for Slim in the next year?

This year I want to polish Slim's identity, build its community, and actually try to market it with better documentation and more tutorials. I hope to reach even more PHP developers with a greater effort to really demonstrate what Slim can do.

Any tips for developers just getting started?

For developers new to PHP, I encourage you to spend more time learning the HTTP protocol rather than focus too much on learning the PHP language. Obviously, you have to know PHP, but don't spend all your time doing so. Knowledge of the HTTP protocol will greatly improve your abilities as a web application developer and will give you skills easily transferred to other languages.

Also, join your local PHP User Group. Believe it or not, there are likely lots of fellow PHP developers nearby. If not, you can join the online Nomad PHP User Group. Joining a PHP user group is a great way to learn from like-minded PHP developers who are available and willing to share their knowledge.

For Slim Framework developers specifically, you should:

  1. Follow @slimphp on Twitter
  2. Read the documentation
  3. Join the Slim Framework support forum
  4. Join the Slim ##slim Freenode channel on IRC

If someone wants to support and/or donate to this project, where should he be directed to?

You can donate weekly with GitTip, or you can send a one-time donation with credit card on my personal site at Any donation is greatly appreciated and will help me continue building great open source software and doing what I love.


Benjamin Broad's avatar
Benjamin Broad
Josh, Genuine thank you for building such an excellent and lightweight framework! Keep up the good work!
yasir naeem chughtai's avatar
yasir naeem chughtai
Thank for building such Nice framework,
Kate Hudson's avatar
Kate Hudson
Great tips there for the PHP developer community-thanks!
Josh Lockhart's avatar
Josh Lockhart NMC team member
@Dnyanesh Thanks! We are currently working on the updated documentation for version 3.0... should be finished soon.

@ Pablo Here are some good resources:


Hope this helps!
Pablo Acuña's avatar
Pablo Acuña
Nice article. BTW what resources do you recommend to learn HTTP more deeply?
Dnyanesh Pawar's avatar
Dnyanesh Pawar
Thanks Josh for this lightweight and fast framework.
Its easy to learn and I personally feel is well suited for APIs.
Hope you will well document it in coming days and reach maximum developers.

Leave a comment