184: PHP Reset, PHP Renaissance: Unify everything in PHP with Composer

It was great to get the chance to sit down and talk with Jordi Boggiano at SymfonyCon Madrid 2014. Jordi is responsible for Composer, one of the most important pieces of technology that is driving PHP interoperability and the PHP "renaissance" of the last couple of years. He's also on the Symfony2 core team.

Use what you know

When I asked Jordi what made him stick with PHP, he replied, "Vendor lock-in, I guess. ;-) It does the job. It's a self-fulfilling circle at some point: It does the web stuff well and I do so much of that that the only ideas that I have are for more web stuff. I would love to do more [with other languages], but I don't have the need."

Jordi's presentation at SymfonyCon, Five Weird Tricks to Become a Better Developer, was a collection of wise advice for developers. On the one hand, pragmatic technical advice like, if you have a tool that works, just use that. Compare the security and safety of using a known set of older tools to the risk of something new and shiny. "One of the points I made was 'Use what you know.' I know PHP very well and I know a but of Python and I know I could do something with it, but it doesn't offer anything [more] than PHP. It has a different syntax, this is nicer, that is not as nice. Down the line, it's still in the same league."

Beyond code - "Think of the people"

Apart from the technical tips, Jordi's Madrid presentation had some good on being a better colleague and person. I was thrilled that Jordi was sharing this kind of wisdom (he called it "random things that annoy me")–"Be a better listener," and "Learn to have empathy, put yourself in other people's shoes." I feel technology communities often focus on code to the exclusion and detriment of everything else. Jordi agreed, "Some aspect of the job," for coders with eyes for nothing but code, "they can't do. If you want to be just code, code, code, you have to go work for Google or something just doing algorithms and being that math-y server guy that does the hard stuff. I'm sure you'll get someone who talks to you and will nurture your dangerous personality, and it'll be fine."

"I think for most of us that are in this business at web agencies or just in general, at web start-ups, I think you have be involved in business thinking and knowing why you are doing things and going a bit further than just the code. The code is a means to get us there. It's by no means an end." Working with clients and colleagues is, after all, essential to keeping most of our businesses running. My concern is that the code-only attitude contributes to the misogyny and poor gender balances in the tech industry; not intentionally, but as a consequence of the neglect of the human side. Jordi adds, "I guess it does play a part ... If you don't have the ability to put yourself in someone else's shoes then you will treat anyone different as though they were you. And then you go with the di** jokes to someone who might not be into that. That's just an example, but obviously ..." a relevant example.

PHP Reset, PHP Renaissance

I asked Jordi what he thought of the statement, "Composer is driving the PHP Renaissance." He seems to be comfortable with that: "I think it's very true in a way. I just thought of a talk I gave three and a half years ago ... maybe two and a half. [Ed.: It was in 2011.] It was a few months after we started [Composer]. I gave a talk called 'PHP Reset' at the IPC in Berlin. I had ten people in the room and nobody really got my point, I guess. But that's what I was seeing coming. With Symfony already, I saw that ... That's why I joined the Symfony project originally; the 2.0 was a clean slate. Not an incremental version over the old stuff that all the frameworks had. It was 'Let's trash the whole thing and start new with a good basis.' That appealed to me."

"This already triggered quite a few new things. There were already a bunch of libraries came out of this Symfony community. I saw all this growing. I saw this Composer thing we were working on and I thought, 'This is gonna be awesome!' and people were kind of like ... yeah? That was frustrating. It was early days, nobody was using it. Nobody knew about it."

"Over a few months it started ramping up and the more people used it, the more they were spreading it by sending pull requests with composer.json files everywhere because they wanted to use these as dependencies. It got really big really quick at some point."


What Composer does: "It combines dependencies. You list your dependencies [the external libraries and resources your project needs to function] in your project. It fetches that, plus their dependencies and checks that everything is compatible with each other according to the requires, glues that all together and installs it locally so that you have all the stuff [your project needs to run]. And all you have to care about is those few dependencies that you need [directly. Their dependencies] are not any of your business." It also allows developers to use components from one source in another, usually incompatible project: a Symfony component in a Zend project, for example. "It unifies the whole ecosystem in that way."

Where Composer came from: "The history of it was that in Symfony, we needed something for the bundles. And at the same time PHPBB needed something for plug-ins. Plus, in Symfony, we also has the need for installing things like Monolog and Assetic, Doctrine that are all required by the framework. Those are not plug-ins, they are just generic libraries. So we needed to be able to install all this stuff. So it just turned into this generic PHP package manager and not just yet another project-specific installer, which was the good thing. That's what allowed it to unify everything and not just install Symfony plug-ins, which would have been a shame."

Guest dossier: Jordi Boggiano

Interview video

Image credit

symcon_madrid_14_jordi.jpg by Robert Nyman https://www.flickr.com/photos/robertnyman/5723325249/ CC BY 2.0 license: https://creativecommons.org/licenses/by/2.0/