PHP Interview With Josh Lockhart The Guy Behind ‘PHP The Right Way’ – Find Good Online Resources And Communities & Use Them To Your Advantage

About This Interview

This is the #38th set of PHP Interview to help aspiring PHP developers and PHP fans alike to get inspired by listening from those PHPeople who are already highly involved into the PHP Ocean and *being there* taming the waves and surfing better than ever to make themselves an Awesome PHP Expert both in their own eyes (for self-accomplishment) and for the PHP Community.

On the other side, this is an opportunity for new PHPers to get to know their “PHP Elders. I hope you will derive as much fun to read my interviews as I’m having by interviewing those awesome PHP people.

A Small Long Intro..

Captain America
Captain America

It’s just PHP, it’s dead easy.. even my kid can do this” – if you have been coding PHP for a while and/or been mingling with different developers or colleagues at some point, you have most probably heard something similar.

When these kind of unhealthy mists are diffused around (coupled with poor tutorials & fluffy code-snippets spread all around the internet), it is obviously normal that all kind of negativity will emerge concerning the integrity of PHP as a language.

But what you need to be aware of, is that most of those misconceptions have been the result of people who have wrongly used the language in one way or the other; a knife is harmful, but does that mean you don’t use it?

These people usually fall in one of the following categories:

  1. novice PHP guys with online presence – they want to be cool by spreading (vulnerable) PHP codes everywhere online; from their blogs to online-php-script-farms (those sites that distribute PHP code for even punching you in the face, remember?)
  2. bloggers with no programming/php experience – they just want to publish ‘a lot of and a lot and a lot more‘ content and codes about PHP
  3. lame php coders with financial interest – these are people who want to write quick codes that ‘just work’ in order to be sold for money
  4. out-dated content – As PHP has marched to what it is now, little has been done by bloggers and article authors to update their PHP articles which were written in the ‘cave-age’ of PHP. Btw, you need to read & re-read Ben Ramsey’s talk on Modern PHP – click!
  5. And the list goes on like this…

“STOP, STOP, STOP! That is enough! We can’t go on like this!

YES!!! Someone finally took the responsibility to make things go in The Right Direction. And this man, this brave man, this ‘super-hero’ is here to make a change happen – he is named Mr Josh Lockhart.

He is The Captain America of The PHP Community! Josh came forward with a convincing righful movement (if I can allow myself to tag it as such) to help PHP-ers get a sense of good direction when it comes to ‘dealing with/and taming’ PHP as a tool to make good software.  This initiative is named as PHP The Right Way!

As with any endeavours that is meant to bring a positive change, it is not just (and cannot be) a one-man show! The Avengers, does that ring a bell?

YOU have to help as well! YOU, yes YOU- if YOU consider yourself part and parcel of The PHP Community, raise forward and help US help PHP be tamed The Right Way!

All the other heroes have joined forces as well and you can find them all here in this list on Github | or see the Credits’ section down the home page on – so join the party, we need YOU as well!

Each one of us has a unique skill and this will help everyone. For community is family and to help family is ‘going beyond in thyself’!

How can you help you say? Aye!

  • Contribute a ‘correct’ tutorial on
  • Proof-read a tutorial on
  • Share and spread the word about
  • If you find an old tutorial online, inform the author about his content being out-dated
  • If you find a code that can be improved, feel free to express your view on it to the author – of course, in a gentleman-nish way. If the author does not respond, blog about it and share with the PHP community!
  • Translate PHP: The Right Way into your language if it hasn’t been translated yet. (This was suggested by Peter Kokotsee his comment below)
  • Add to this list (make a comment below and I will include yours here..)

THOUGHT/ProTip: PHP is not just about the codes, it’s much more than that – It’s about The Community!


Time to get back to our 7PHP ‘PHP advice’ from people doing it the right way. Let’s now hear from Josh Lockhart!

And Now The Interview..

>> Please tell us a bit about yourself

I am a developer at New Media Campaigns, a web design, development, and marketing agency in the amazing small town of Carrboro, North Carolina. I’ve worked for New Media Campaigns since 2007 where I juggle both front-end and server-side development.

During my spare time, I enjoy participating in open source projects. I created and maintain the Slim Framework, a popular PHP micro-framework that makes it easy to develop web applications and APIs. I also created and maintain PHP The Right Way, a popular initiative in the PHP community to demonstrate PHP best practices, accepted coding standards, and links to authoritative tutorials around the Web.

I graduated from the Information and Library Science program at the University of North Carolina at Chapel Hill in 2008 and currently live in Chapel Hill, North Carolina with my wife and two dogs.

Josh Lockhart
Josh Lockhart

>> How you started with PHP

I started learning PHP back in the early 4.x days when I was in high school. I had already picked up some basic HTML and CSS skills, and I wanted to expand my toolset.

PHP was the most accessible programming language to me at the time, so I bought some books at Barnes and Noble and spent many late nights reading, learning, and slowly building my skills while working on freelance projects.

>> Your LAMP stack comprises…?

I don’t use the traditional LAMP stack. Instead, I run a separate Ubuntu Server VM with Vagrant for each ongoing project. Each VM runs nginx, php-fpm, MySQL, and other tools depending on the project.

I had initial doubts about this workflow when Kris Jordan first introduced me to Vagrant, but I’ve fallen in love with the process. I can setup and teardown VMs really quickly. All of my work is stored in GitHub and accessible on whatever computer I happen to be using at the time.

>> How do you find PHP now as compared to when you first started

There’s no comparison, really. PHP today is lightyears better than PHP when I first started. It still has its oddities, but what programming language doesn’t?

>> Based on your experience, what are the good and bad parts of PHP

A lot has been written about this, so I’ll be brief. The best parts of PHP are summarized on PHP The Right Way. But if I had to pick, I’d say that Composer and Packagist are probably the two most important additions to the PHP community in the history of the language.

The worst part of PHP (well, the one thing that constantly annoys me) is function naming inconsistency. There are some functions that I always have to Google to remember the correct signature.

>> What would be the Top advice to a PHP beginner

Find good online resources and communities and use them to your advantage. There are so many online resources about PHP, and most of them are either outdated or just not that great.

This is one of the reasons I created PHP The Right Way, and I’m thrilled that so many community experts and leaders have helped contribute to the project. I’d start with that.

Also seek out your local PHP User Group and go to as many meetings as you can. Not only will you learn new skills, but you’ll make friends and networking connections.

>> To someone who wants to become a better PHP developer..?

See previous

>> What are some common PHP mistakes you often see beginners make?

Beginners will often re-invent the wheel, so to speak. Which is a decent way to learn, but it’s not very efficient. Instead, I recommend using existing components (e.g. via Composer and Packagist).

You can learn from reviewing the components’ source code. Once you get comfortable, you can even submit a pull request or two.

>> The best PHP book you’ve read

I don’t have a particular book, perse. I’ve mainly learned from online resources.

>> A PHP blog or resource you highly recommend

Well, I hear PHP The Right Way is great, but I may be biased! Some other good online resources are:

The online PHP documentation is also a surprisingly good, reliable resource, especially the user comments.

I also recommend that you find and follow active and reliable PHP users on Twitter.

>> The IDE that you use

I use SublimeText and vim for my day-to-day editing. I’ve recently started using PHPStorm specifically for working on the Slim Framework, but I’m not yet proficient with it.

Honestly, I’m happiest with a simple text editor and a terminal window.

>> How do you debug your PHP code?

I use PHPUnit for unit tests. I use XDebug with MacCallGrind when I need to troubleshoot performance issues.

>> A PHP framework you use and would recommend

For small sites and APIs, my own Slim Framework is nice, as is Silex.

For larger applications, I’d steer you toward Laravel built by the incomparable Taylor Otwell of UserScape.

Taylor Otwell
Taylor Otwell

>> A unit test framework you recommend using?

PHPUnit. It’s been around forever, but it’s still the best.

>> A CMS that you think is worthwhile

Whatever works best for the job. I’ve recently become fond of Drupal, but it’s certainly not for everyone. ExpressionEngine seems to be on its way out the door. Several other favorites are HiFi and Statamic.

>> An E-Commerce cms you recommend

None. I’m not a fan of e-commerce, and I would typically avoid self-hosted e-commerce systems. If you want to do e-commerce, I’d use Shopify in conjunction with Stripe. This way infrastructure and PCI compliance are outsourced to people who know what they are doing!

>> Do you recommend using database layers and ORM? If yes, what database “framework” you would recommend?

It depends. For quick prototypes or for applications where absolute performance is not a big concern, then ORMs are fine. But they should not be a crutch for poor SQL skills.

You should make certain that your ORM generates efficient SQL queries. If you do need to worry about performance, nothing beats dropping down to raw SQL and PDO.

If I had to recommend a particular ORM, I’d use Laravel’s Eloquent component.

>> One PHP library/Project you really appreciate

Twig. No competition. It seems like every project I make uses it. It’s the best PHP templating framework out there, even better than PHP itself! Fabien Potencier is a genius.

>> One PHP person that you admire and what strikes you about him/her

Phil Sturgeon - PyroCMS Founder
Phil Sturgeon – PyroCMS Founder

Phil Sturgeon. He’s always pushin’ code and gettin’ it done.

>> Which was the worst programming mistake you did?

There are too many to list. I can’t remember them all.

>> Things that you’ve learned from being part of The PHP Community

The most important lesson I’ve learned is that there are no “famous” PHP people… there are only people that participate and make things happen.

I’ve also learned that there is no shortage of opinions, and that the PHP-FIG is the best and worst thing ever.

>> How do you time manage all the stuffs that you do, coupled with your personal life?

It’s not easy, but I try to stay off my computer as much as possible after I get home from work. But sometimes my wife and I will crash at our local coffee shop and I’ll knock out some code and catch up on GitHub issues.

>> The day you realised “You’ve made it to the A-List PHP arena” ?

There’s an A-List?! haha. I certainly don’t consider myself on it. But I think PHP The Right Way is my proudest accomplishment when it was able to bring so many PHP users together for a common good.

>> Why you are successful and why others are not?

Success is relative. You can be successful in your company, your local user group, etc. The key is to just get involved. I got involved and created open source projects on GitHub. With a bit of luck and a lot of hard work, I’ve gotten to where I am today.

>> The best conference you attended would be…

Actually, I have not attended a conference yet. I’m not really a conference person. As my wife can confirm, I’m a pretty quiet guy, I’m not a fan of large crowds, I don’t drink alcohol, and I’m most comfortable sipping a coffee while coding away at my local coffee shop.

I’m sure I’ll find myself at a PHP conference eventually though!

1 Comment(s)

  1. This is indeed a very nice initiative from PHP: The Right Way. If I may I would add the following to the section of this interview “How can you help you say? Aye!”
    – Translate PHP: The Right Way into your language if it hasn’t been translated yet.

    Case is that translating such sites to other languages is perhaps a bit time consuming task since everyone speaks English but it is good for local PHP User Groups to gather and have some more common terminology.

    Thanks and regards.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.