Lessons from 9 years of a homegrown PHP framework
> What I learned maintaining an in-house framework for years, and when writing your own is worth it at all.
When our team decided not to pull in Laravel for the next project but to build a thin routing and DI layer instead, everyone knew it was a risk. Nine years on, I can see what paid off and what didn't.
##When it's worth it
A custom framework is a good call when your domain is so specific that an off-the-shelf framework's conventions keep getting in your way. For us that was the integration layer: a dozen external systems, each with its own auth and error handling.
$kernel->pipe(new AuthStage($vault))
->pipe(new RetryStage(maxAttempts: 3))
->pipe(new TelemetryStage($otel))
->handle($request);The pipeline approach was the best decision: every external call went through the same few stages, so auth, retry and telemetry lived in one place.
##What I got wrong
- →I abstracted too early, the first version had flexibility we never used.
- →I didn't write enough docs, so onboarding new colleagues took weeks.
- →The custom ORM layer was the biggest mistake. Never worth it.
If I started over: a thin glue layer yes, a custom ORM never. Leave database abstraction to the pros.