PHP Interview With Phil Sturgeon The Man Behind PyroCMS – Follow A Standard It Doesn’t Have To Be PSR-1 or PSR-2

Contents At Glance

Purpose Of This Interview

This is the #34th set of PHP Interview to help aspiring PHP developers and PHP fans alike to get inspired by listening from those PHP guys 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 A-List PHP guys.

A Small Intro..

Phil Sturgeon - PyroCMS Founder

Phil Sturgeon – PyroCMS Founder

In this edition I talked with Phil Sturgeon who is the founder of the CMS named as PyroCMS. He also wrote a book about it called “Catapult into PyroCMS“. @Philsturgeon is very much involved in The PHP Community; he regularly participates in conferences, is a prominent voice and voting member of The PHP-Fig (aka the PHP Framework Interop Group, I also asked him a few questions about it) and he has been amongst the core contributors of PHP Frameworks like CodeIgniter (CI) and FuelPHP, although he is now opening his arms towards Laravel PHP framework (the PHP Framework for Web Artisans). On the professional scene, he is the Lead Engineer at Kapture. I now invite you to learn from his experience and get to know his personality. (I’m also thinking of doing a follow-up on PyroCMS with him soon!)

Something worthwhile to mention is that Mr Sturgeon is participating in the “Autism Awareness and Research” where he’s cycling/participating to raise money – to know more about how to donate or participate, see his personal home page at: philsturgeon.co.uk.

And Now The Interview…

>> Please tell us a bit about yourself

I am Phil Sturgeon, a PHP blogger who has worked on a bunch of open-source projects, written loads of articles about programming stuff and occasionally talk at conferences. I spent years freelancing and consulting for various people, before recently laying the anchor as Lead Engineer of Kapture. Here as well as PHP I write a lot of Python and work with all sorts of devops magic.

>> How you started with PHP

I used to manage a website called GameZone3000 when I was 11, it was all about flash games, video games, reviews, cheats, etc and implemented Amazon referral codes to make money. I managed the whole thing with static HTML and it was incredibly hard work – with only iframes seeming to help out. A friend pointed me to phpBB and sent me some PHP tutorials and suddenly life became a LOT easier.

>> Your LAMP stack comprises.. ?

For basic CMS-based projects I just use MAMP Pro, but for anything more complex I use Vagrant to run Ubuntu, PHP 5.4, (My/Postgre)SQL

>> The relationship between You and The PHP Community comprises..

  • I used to write a lot of articles about CodeIgniter and release a lot of code for it; so much so they eventually let me be a core contributor, where I added a load of features along with the rest of the “CodeIgniter Reactor Engineers” and oversaw the merging of thousands of pull requests.
  • I was the second team-member on the FuelPHP project where I mostly worked on the CLI utility “Oil“,
  • founded the CMS PyroCMS,
  • contributed huge chunks of text to PHP the Right Way,
  • am a voting member on the PHP-FIG
  • and started up a podcast called PHP Town Hall with my friend Ben Edmunds.

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

The language itself has come on leaps and bounds since the PHP 4 days, and while it still has plenty of room for improvement things like namespaces and anonymous functions have given us the basic tools to build some really interesting components. Composer has given the ecosystem a massive boost and we’ve been enjoying a renaissance for the last year thanks to it.

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

I can smash out prototypes like a man possessed, which means I can get paid more faster. Beyond that using frameworks like CodeIgniter and Laravel 4 I can build a solid code-base which I can then hand off to the most junior developer and have them look after it, which means I don’t get client calls years after the hand-off asking me to update their contact form…

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

  1. Go through CodeAcademy
  2. Google every error message. You’ll always end up on StackOverflow, but it’s worth searching just in case a blog pops up

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

  1. Read PHP The Right Way. It’s got some advanced stuff on there, but it has something for everyone and a lot of best practices.
  2. Follow a standard. It doesn’t have to be PSR-1 or PSR-2, but it definitely could be.

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

if ($foo === true) {
return true;
} else {
return false;
}

Urf.

>> The best PHP book you’ve read

I’ve not read many PHP books, but I liked Larry Ullman‘s PHP Advanced and Object-Oriented Programming

>> A PHP blog or resource you highly recommend

The comments get super petty, but on the whole its an amazing resource for fresh PHP happenings.

>> The IDE that you use

All Sublime Text 2 all the time.

>> How do you debug your PHP code?

  • I have a lot of logging set up on complicated projects, so things like Graylog2 and Monolog can be a nice solution.
  • Xdebug is great if you can get breakpoints set up, but don’t be afraid to just var_dump() everything until you find a solution.

>> A PHP framework you use and would recommend

Laravel 4 is an amazingly powerful, quick and flexible framework. If you’ve never used Laravel, or have used a previous version, you’ll be in for a surprise.

>> A unit test framework you recommend using?

There are alternatives to PHPUnit? (#troll)

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

Laravel 4 has a ORM called Eloquent which can run entirely by itself. It’s simple, lightweight, and handles relationships, eager/lazy loading, mass assignment protection, etc nicely.

>> One PHP library/Project you really appreciate

Obviously Composer, but that’s a boring answer.

Alex Bilbie has created a spec compliant, PSR-2 compatible, OAuth 2 server which has PDO drivers, Eloquent drivers and some Mongo drivers floating around somewhere.

https://github.com/php-loep/oauth2-server

>> One function that you like (or which you tend to use frequently)

Not only does it have a cool name, but its great for “Did you mean…?

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

Taylor Otwell (author of Laravel) has broken into a crowded marketplace (who hasn’t released a PHP framework before…) and made a massive storm in the community, without treading on anyone else’s toes or developing an unbearable ego. He’s created a framework with beautiful syntax, kept innovation moving, kept the community involved and more importantly put up with me pestering him on Skype at all hours of the day and night whenever I spotted a bug or had an issue.

>> One PHP Community that you recommend

PHP-FIG isn’t somewhere to go to make friends, but it is a great community of people trying to make a lot of PHP-land better. Join up, weigh in, and maybe help shape the future of some big projects.

>> A PHP Usergroup that you appreciate and would highly recommend

PHPNE in the UK is amazingly welcoming to outsiders and full of awesome people. They also know how to drink.

>> Which was the worst programming mistake you did?

I once left a line of debug in some code which would run in a for loop up to 10 times on a login attempt, each time sending out an email. Somehow this got past peer review, and the QA team. When a few thousand users started logging in at 9am it smashed the mail servers and caused some real problems on the network… Oops.

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

People are quick to laugh at me, or judge me for being “just a PHP developer“, but I love the attitude of most PHP developers. We might not have impressive neck-beards, or leather jackets and Ray-Ban’s, but our code is powering 80% of the internet and it hasn’t fallen over yet.

>> If you could change one thing with PHP, that would be…?

Named parameters. Arrays just don’t cut it (you can’t properly document an array) and creating objects just as parameter bags is ridiculous. Ruby and Python do this perfectly, but the PHP core developers who want this have always been outnumbered by people calling this “unnecessary” or “overly-complicated”, which it obviously isn’t. At all.

>> You are also a Ruby (Ruby-on-rails) developer – what aspects of Ruby, can we PHP developers learn from it?

Ruby’s usage of blocks (PHP has callbacks, which is close enough) can inspire excellent API design. PHP developers focus too much on long-winded argument lists, when passing a few objects to a anonymous function can be a lot neater.

>> What things does PHP lack as compared to Ruby?

PHP still has a terrible REPL in the core. If you have php5-readline then its a little nicer, but to be any real use you need to install Boris.

https://github.com/d11wtq/boris

PHP also needs a little longer to build out quality code packages. People are all hard at work building Composer packages, but Gems have been going a lot longer. You think of it, Rails has a Gem for it. It might not work with all the other gems you expect it to (no Ruby-FIG to help guide the interaction I guess…) but when they work they are extremely awesome.

Other than that, PHP is just lacking a little syntactic sugar compared to Ruby, but that’s never really been something I care about.

NOTE: (REPL means Read-Eval-Print-Loop)

>> What things can Laravel or any other PHP Framework learn from Ruby-on-Rails?

Laravel has already learned a lot from Ruby-on-Rails. The Schema system and Migrations are very similar. Database Seeding, generic queue interface, tasks, etc are close to feature parity with RoR.

>> Areas where PHP excels from Ruby?

Portability and speed. It might not be as beautiful, but PHP will run on any $5 a month SSH-less VPS and it will do it relatively well.

Phil and PHP-Fig

>> How did PHP-Fig come around and who started it + when?

From the FAQ: “The group was bootstrapped by a number of framework developers at php|tek in 2009. Since then various other members have applied and been voted in, increasing the size of the group from the first 5 to over 20.

>> The initial sole aim of creating it?

I wasn’t around for the decision making, but the idea is to see how different projects can work together to make everyone’s lives easier. By defining standards and interfaces we can reduce the amount of “adapter” code bridging the gaps between packages, and stop developers constantly have to switch their IDE settings (and brain) to use a different standard for every project they work on.

>> Do you think that aim is still being preserved?

Absolutely. The number of PSR’s per year has been low, but there are several proposals tantalizingly close to reaching the voting stage, so 2013 should see another 2 at least.

>> It is not The standard for The PHP Community, but ‘a’ standard for most (or all?) framework developers to adhere to. Is this true? What is your opinion?

Sort of. PSR-0, 1 and 2 are all standards which anyone in the PHP community is absolutely welcome to use, but nobody is forcing you to use it. It’s not just for frameworks, but for component/package developers, open-source applications, and anyone who feels like using an existing standard at their company instead of inventing their own.

>> I have observed there are alot of confusions and disagreement going on among peers and collaborators. Could you talk a bit about some of those discomfort zones going on and why you think they are happening + what solution do you propose?

Every now and then there is a bunch of noise in the PHP community from people who consistently misunderstand the aims of the FIG. This is usually because some developer thinks “They’re coming to take away my tabs” or “I’m Allman until I die!”. Now and then somebody misunderstands the point of an auto-loader spec, thinking we should be defining some auto-magical auto-loader that loads all historical PHP code to ever exist.

There are a lot of ways to skin a cat, and with a community as large as PHP we’re never going to get 100% agreement on anything. What I appreciate about the PHP-FIG is that we’re all making compromises with our coding standards. Folks seem to think its just Zend and Symfony telling everyone what to do, but in reality everyone gets a vote with equal weight, so Symfony gets as much say as PyroCMS does, and we historically have very different ways of going about things.

>> Are you happy with the way PHP-fig is moving?

I certainly am. A quick look at our board might make us look like a bunch of argumentative jerks, but things are moving forward all the time. We might not be improving the entire community this year, but every step being made has been a good step forwards. Tortoise, not the hare.

>> Your message to The PHP Community with regards to PHP-fig

The PHP-FIG is part of the PHP Community. Every voting member has joined up because they care about PHP and want to help projects work together. If you have an open-source project and want to be represented then get on the Mailing List, get involved in conversation, find yourself a sponsor (someone to say “Yep, this dev is alright”) then request membership.

More importantly, don’t let your own personal preference destroy community progress. Blogging hate about the FIG just because you prefer to use tabs over spaces is not helping anyone, and to be fair you could just switch your IDE settings…

>> If you have to change certain things with it, what would they be?

The PHP-FIG is a definite sausage-fest. Getting more female developers involved in the conversation would be useful, as after all, the PHP-FIG is meant to represent the PHP community and the PHP community isn’t 99% male.

Phil and Conferences..

>> The best conference you attended would be..

True-North PHP was a blast, with good content and a good bar. Can’t go wrong with that.

>> Can you please share the good, and may be not so good moments, of being part of all the conferences you attended

The best part of attending a bunch of conferences is meeting all the people behind the projects and Twitter handles. You name an interesting PHP project and I’ve probably had beers with the people that made it! That makes life a lot easier when I have a problem, feature request, etc.

The worst part is probably when sponsors force a badly prepared yawn-fest of a presentation down your throat. “Oh, you’re hiring developers for an incredibly boring job? I’ll quit my job immediately, your mundane presentation has me sold!” Sponsors have to remember to keep it interesting, and always send an evangelist (or someone with energy) over the MD.

>> What are the main aspects of conferences that can really help a PHP guy to get better in his progression

Speak! As soon as you spot the un-conference boards go up sign up for a slot. There is often not much competition and its relatively first-come first-serve. If you don’t get it first time, try again at the next conference. Tell people about what you are working on, what you’ve discovered and how you got over any problems. People will give you feedback to improve if it sucks, so there is no harm done. My first few talks were awful – I was a nervous wreck – but then I got some practice and now I am noticably better. It’s always scary, just do it.

Closing out with Phil (aka The Englishman in New York)

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

Every project I am part of has a number of amazingly talented, committed, hard-working developers either in the core team or as open-source contributors. I am lucky in that respect, and it gives me time to ride my bike and get to the pub.

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

I don’t think I’m A-list, I just spread my opinion, talk about stuff I like and occasionally make a fool of myself at conference hotel bars. People listen to my advice and suggestions because I’ve done things wrong enough to know how to do them right.

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

For people to notice you, you have to shout. Blog, screen-cast, submit talks, send pull requests, get active in the community. You can be the best PHP developer in the world but if you just quietly get on with your job and go home then nobody other than your boss (who is consistently taking all the credit for your work) is ever going to know you exist.

If You Appreciate What I Do Here On Seven PHP :: 7PHP, You Could Consider:

  1. LIKE-ing 7PHP dot COM on FaceBook
  2. 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
  3. Make a comment below using the comment form

{I’m thankful to your response(s)!}

If You Appreciate What I Do Here On Seven PHP :: 7PHP, You Could Consider:

  1. Following me on Twitter | @7php
  2. LIKE my page on FaceBook
  3. Help diffuse this interview to the PHP ecosystem - Share & Spread the word as far as you can ==> That would be a FREE way to thank me
  4. Use my DigitalOcean referral link if you plan to use it as your VPS (it starts at only $5/month btw) or if you can refer it to your friends, highly appreciated.
  5. You can also contribute financially which would help me expand 7PHP More.

{I'm thankful to your response(s)!}

Speak Your Mind

*