The same slow request inspected in both frameworks. PHP has quietly become a pleasant language to write. Typed properties, enums, readonly classes, and now property hooks remove a lot of the boilerplate that gave it a bad reputation.
Comparing the tools
We took a class from a six-year-old codebase and rewrote it with current language features. The result is half the length and, more importantly, the invalid states are no longer representable.
What we would change next time
None of this is new, and that is the point. The techniques that last are usually the boring ones that are documented well and supported by the platform itself.
- Use readonly properties for value objects.
- Replace string constants with backed enums.
- Commit a PHPStan baseline and shrink it over time.
- Autoload everything through Composer.
Is there a repo with the full example? Happy to open a PR with a TypeScript version.
This finally clicked for me after reading the docs three times.
The quote in the middle is doing a lot of work here, and it earns it.
Our accessibility audit flagged exactly this last month. I wish I had read this first.
Is there a repo with the full example? Happy to open a PR with a TypeScript version.
Counterpoint: for small teams the simpler approach in the first section is usually enough.
This is exactly the write-up I needed this week. We hit the same wall last sprint.
Counterpoint: for small teams the simpler approach in the first section is usually enough.
Great post. Did you measure the impact before and after, or is this mostly from experience?
Is there a repo with the full example? Happy to open a PR with a TypeScript version.