Becoming a PHP Core Contributor

Becoming a PHP Core Contributor November 26th, 2015, by matthew@matthewsetter.com

What does it take to be a PHP core contributor? What things do you have to do? Why would you do it?

I recently started on the journey from PHP user and developer to core contributor, and I want to share my experiences with you, in case you’re keen to do the same, or if you’re just curious about what’s involved.

Why be a PHP Core Contributor?

That’s a good question. Here’s my perspective. First of all I’m not a glory hound. So it’s not for ego gratification. Sure, I hear you say. But seriously, I’m not. One of my key aims is personal achievement.

It’s definitely not about ego gratification. I think you’d have to have a pretty big ego to stay the course throughout the journey - if that’s your motivation.

I’m human after all. But that’s not what’s really driving me here. What’s really motivating me to do this, is something else entirely.

 Where My Journey Began

Ever since I began working with PHP some 15 years ago, after a chance encounter with it, I’ve always had it in the back of my mind that, one day, I’d like to contribute to the PHP core. I saw it as a desirable goal for several reasons, including:

  • Getting back to developing in C (I started out learning C, C++, and Java)
  • To broaden my language knowledge from PHP, JavaScript, bash and a smattering of others
  • To give back to the community
  • To really know more about what’s going on under the hood of PHP
  • To prove that I know my stuff

Perhaps the core motivation is the last one, to prove that I know my stuff, to prove that I am a “real” developer. For those who don’t know me personally, this might seem like a strange thing to say. And maybe I see it differently to how others do.

But I’ve always had a nagging self-doubt. I’ll be honest; I’ve not always done so well over the years as a developer. I’ve made my fair share of mistakes.

And a lot of the time I’ve either taken them more personally than I should have, or have let people run me down pretty harshly because of them.

At one time this had become so bad, that I almost walked away from software development in pursuit of another career, any other career.

That’s right - I almost walked away. Things just seemed to keep getting worse. And there seemed like there was nothing I could do about it.

Now I say seem, but perhaps it wasn’t so. I’m not going to go in to intimate detail as to the specifics. But at least in my mind I felt, ever more strongly, that I wasn’t cut out to be a developer.

It felt pointless to keep going. Why continue when things kept going wrong? The negative self talk was nearly all consuming.

But despite it all, I kept remembering that being a programmer, being a software developer, being a software craftsman was something I’d wanted to do my whole life.

Despite the insecurities and the mountains of self-doubt, it was something I’d invested years of my life in.

It was something I’d sacrificed really hard for, improving myself when I could have been doing countless other things. It was something I just knew I wanted to do - to be. So I chose not to walk away.

In a way, you could say, I restarted my career at that juncture. Ever since then I’ve had a new, and better, question in my mind:

How can I prove that I know my stuff?

This became really important to me, because I wanted a benchmark, a gauge, something tangible with which to measure myself, to hold myself accountable, to keep myself motivated, and to negate the naysayers.

I wanted a definitive way to prove to the outside world, but perhaps more importantly to myself, that I am a “real” developer. Then along came a golden opportunity, contributing to the PHP core.

Why’s It So Golden?

Let’s think about it. To become a core developer, I’d say you need the following skills:

  • Personal organisation
  • Dedication & persistence
  • Clear thinking
  • The ability to communicate clearly, cohesively, and convincingly
  • The ability to negotiate
  • The willingness to be flexible and compromise
  • The ability to program in C (or the willingness to learn)

Note that only one of these skills is software development. I think that’s an important distinction. The other skills are more important. You might be gasping at this stage, gob smacked by the heresy I just spoke. But it’s true.

Why’s this so? It’s because if you’re a more than average developer, you can learn another language, applying the skills you have to bring you up to speed quickly. If you want to learn even faster, there’s a range of steps you can take, including:

  • Finding a mentor to help you grow
  • Reading numerous books
  • Take numerous courses
  • Listen to an ever growing array of podcasts

I believe fervently that the other skills are more important. Why? Because any project, of the size of PHP, isn’t built by any one person. It’s built by a group. Whether that’s a focused team, or a more loose assemblage, it’s built by a group.

To be a part of that group, you have to have personal and interpersonal skills. These are what the first six are. You can be an excellent developer; but as the saying goes, if no one wants to work with you, it’s going to be hard to be an active member.

Lucky for me, I like to think that I have most of the first six developed sufficiently. Sure, my personal organisation still needs some work. But I think I’ve shown a strong willingness and proficiency with them.

Developing in C however, on that point I’m a little rusty. It’s been a while since I wrote anything of sufficient size. So it’s going to take time to build those skills back up again.

Having said that, if I’m right, then over the course of this journey, I can be very self-assured that I’m a true professional as I come out the other side. So it was for these reasons, that I wanted to do this.

How Did the Opportunity Arise?

Recently, whilst I was creating a patch for Zend\Db, I came across a situation where there wasn’t a function to do what I needed to do in core.

Specifically, I wanted to know if the array which I was working with was scalar or associative. Given the plethora of other array functions, I’d have thought that it should have been there.

// is it this
[‘one’, ‘two’, ‘three’];

// or this
[
  ‘first’ => ‘one’,
  ‘second’ => ‘two’,
  ‘third’ => ‘three’
]

Here’s a simple example. What I wanted to know was whether the array I was working with was like the first one above, one which didn’t use any deliberate keys. Alas (perhaps that’s a bit dramatic), no such function exists.

What’s the problem, you might be asking. Just write it in userland PHP. Sure, that I can. The solution I took was this one:

private function isAssocativeArray($arr)
{
  return array_keys($arr) !== range(0, count($arr) - 1);
}

Talking to others, they proposed a host of similar solutions. Here’s a few of them:

function isArrNum($arr) {
  foreach($arr as $i =>$v){
    if (!is_int($i)) { return false; }
  } return true;
}

count(array_filter(array_keys($array), 'is_string')) > 0;

array_filter([...], 'is_int', ARRAY_FILTER_USE_KEY)

Arguably, from the pragmatic side, I could have worked with any of these. But something about it stood up and grabbed my attention. It just seemed like it should be there. Queue dramatic music. So I decided to press on and figure out how to validate the idea.

My Journey Had Begun

Yep, I was on the way. I don’t want to go on too long in one post. In the next couple of days I’ll have another post which covers the next few steps I have and will be taking.

Specifically, I’ll cover the feedback from mailing the internals list, along with what it was like to create an RFC around the idea.

I’d love to know if you’re in a similar position as myself, and whether you’re thinking of proposing an RFC as well. Please share your experience and thoughts in the comments.

CC Image (background of main image) Courtesy of Remko van Dokkum on Flickr


Like That?

Don’t miss my next post. Drop your email in the box below, and get it straight to your inbox, PLUS exclusive content only available by email. No spam, and you can unsubscribe at any time.