Thinking About PHP Toolchain
Juggling multiple runtimes for various projects has me thinking about how much dealing with PHP is a huge pain in the ass.
Why is that though? Maybe it’s not? Maybe it’s just me? I don’t know.
Why is the Ruby ecosystem so much more pleasant from the developer experience? Why is Go more pleasant? Why do they seem more developer friendly?
And I mean developer friendly as in the operational sense:
- Easy to install
- Easy to switch versions
- Easy to reason about environments
- Easy to reproduce across machines
Not:
- Syntax Friendliness
- Language ergonomics
- Learning curve
PHP is very beginner-friendly as a language, but not as a toolchain.
Anyway, I think I can answer the question of why.
- Ruby and Go assume the runtime belongs to the project.
- PHP assumes the project belongs to the runtime.
From that lens all of the frustration I have with PHP become obvious that I am doing it wrong. I keep trying to manage PHP as if the runtime belongs to the project. The PHP ecosystem feels fragile and unsupported when trying to move responsibility from ops to dev because it is. It is still quite early in the evolution of PHP from an infrastructure based ops managed runtime into a developper managed part of the toolchain.
Some other thoughts:
- Composer solved only half of the problem. It has made PHP feel modern without modernizing the runtime model. Dependencies are nicely handled though.
- Docker is an excellent solution for PHP development because it restores PHP to its comfort zone as an ops managed infrastructure.
update
Thinking about how to support my team at $dayjob. We use Macs exclusively for development. We use Lando for the WordPress projects, which is docker based, so there is need to even have PHP installed on the host machine. For Laravel projects we use Docker Compose, again no reason to even have PHP available locally. Our build tooling can execute composer and other tools in the docker container. Could not be easier.
On my personal projects I write more Ruby and Go than I do PHP. I have been doing a lot more with PHP lately though and am running into the friction of installing different versions of PHP on baremetal. Mise-en-place (and similar tools) have made it so easy to manage and switch platforms on my projects that I have taken for granted how much complexity there is under the hood to make my dev life so easy.
more updates
So much <3 to all of the folk trying to make this work. Not an easy task. And a thankless one at that.