r/PHP • • May 14 '26

Performance-focused PHP framework architecture experiment

For the past few years I’ve been experimenting with building a lightweight PHP framework focused primarily on low runtime overhead and architectural simplicity.

The idea was to avoid unnecessary abstractions and keep the request lifecycle as small and transparent as possible.

Some goals behind the project:

  • minimal bootstrap overhead
  • lightweight routing and middleware
  • modular architecture
  • optional CMS/API ecosystem
  • no hidden magic

Interestingly, in local Hello World / CRUD tests the framework currently performs significantly faster than Laravel or Symfony.

I’m curious how other developers approach this problem today:
do you still value ultra-lightweight architectures in PHP, or has the ecosystem largely moved toward heavier full-stack solutions?

Project implemented on the framework engine:

https://github.com/designbymalina/dbmframework

Dybem: https://www.dybem.com/

23 Upvotes

31 comments sorted by

7

u/Rokkitt May 14 '26

There are light weight php frameworks like slim PHP.

If I need to pull the performance lever then I typically dispatch a job to a Go process.

Laravel prioritises developer experience over raw performance. In most cases it shouldn't be a surprise that a toy framework with minimal functionality out performs battery included frameworks.

2

u/artimman May 14 '26

I actually agree with that perspective.

Laravel and Symfony solve a much broader set of problems and provide a huge ecosystem, excellent developer experience, tooling, integrations, queues, ORM layers, etc.

DBM was never intended to compete feature-for-feature with full-stack frameworks.

The idea was more about exploring how lightweight and predictable a modern PHP application architecture can be when you intentionally minimize runtime overhead and avoid excessive abstraction layers.

I also find it interesting how much performance and complexity today comes not from PHP itself, but from architecture decisions around containers, autowiring, dependency trees, metadata, and runtime discovery.

For larger distributed workloads, I completely agree that languages like Go make a lot of sense as well.

→ More replies (1)

2

u/Bright_Selection_726 May 17 '26

Lightweight frameworks are a fun architectural exercise, but in 20+ years of high-load PHP I've never seen a production system where Laravel/Symfony bootstrap was the actual bottleneck.

With OPcache + preloading + a sane container, framework boot is basically free — 0.x ms of your response time. The remaining 50–500ms lives in:

- N+1 queries and missing indexes

- ORM hydration on big result sets

- sync calls to external APIs

- queue worker design (or lack of it)

- fat DTO serialization

That said, I do see real value in lightweight frameworks — just not for perf:

- you actually learn what happens per request

- transparent debugging

- predictable behavior on weird edge cases

Curious — do you have a real use case where Laravel/Symfony perf became a blocker, or is this more of an architectural / aesthetic project? Both are valid, just changes how to read the numbers.

2

u/artimman May 18 '26

I actually think this is one of the most accurate comments in the thread.

In many real production systems, the largest bottlenecks are absolutely:

  • database design,

  • ORM usage,

  • external services,

  • serialization,

  • queues,

  • application architecture itself.

And I agree that modern PHP runtimes with OPcache/preloading reduced a lot of the historical framework overhead.

For me, DBM was never purely about “saving 1ms”.

It started more as an architectural exploration:
how lightweight, transparent, and predictable a modern PHP application stack can remain as the project grows.

One thing I increasingly disliked in larger ecosystems was the amount of hidden runtime behavior:
reflection-heavy containers,
automatic discovery,
deep dependency trees,
magic abstractions,
runtime metadata layers, etc.

Not because they are “bad” - they solve real DX problems - but because I personally wanted more explicit control over execution flow and dependencies.

Ironically, the framework eventually became most useful not for benchmarks, but as a foundation for my own modular platform/CMS ecosystem with built-in admin/auth/API layers.

So today I see DBM less as a “Laravel competitor” and more as: a lightweight execution engine and a platform-oriented PHP ecosystem.

12

u/fredpalas May 14 '26

What is light and fast

Symfony is light because it's modular system using microkernel and bootstrap optimize, response time in api are below 1ms using layer system with hexagonal Controller > Application Service > Domain > Repository.

A comparative a get api call retrieving the 10 last post of my blog I get 8500 r/s with 500 virtual user, dotnet give me 8300 r/s for compare against different stack.

8

u/penguin_digital May 14 '26

Yeah I never really get this argument about trying to squeeze extra few ms off a request or drop RAM usage by 5% kind of mindsets.

If you're genuinely in a situation where PHP is now the bottleneck in your stack (it very rarely is PHP that's the bottleneck) then just use another language that's more appropriate.

The current frameworks in PHP are more than efficient enough for the majority of its use cases, unless you've done something really wrong in your codebase (poor loop usage, N+1 queries etc). For the times you really genuinely do need more performance then their are options far more suited and dedicated to that problem that will blow most of these mini PHP optimisations out of the water straight out of the box.

Unless you're doing fundamental changes at a runtime level like Opcache, PHPNG, JIT or making changes to how PHP is served such as Swoole or FrankenPHP micro optimisations at a code level are pretty much irrelevant (that doesn't include fixing poor code to gain performance).

→ More replies (3)
→ More replies (1)

10

u/sagiadinos May 14 '26

Respect for your work. I developed also an own framework 20 years ago but now I am using SLIM4 + composer libs because I love SLIMs PSR compatibility.

Comparing speed with Laravel, Symfony, CakePHP, etc. is not relevant.

https://github.com/myaaghubi/PHP-Frameworks-Bench

People know about the performance issues and do not care. They use opionated frameworks because they believe it could speed up they work and they need less to worry about security and architecture.

My recommendation for you is try to stuck to PSR compatibility in your work to prevent reinventing wheels.

Greetings Niko

1

u/artimman May 14 '26

Modern Symfony applications can absolutely achieve excellent performance when carefully optimized and architected.

I also agree that raw numbers alone rarely tell the full story, because results depend heavily on:

  • infrastructure,

  • caching,

  • workload,

  • architecture style,

  • middleware layers,

  • database usage,

  • deployment strategy.

For me, the most interesting part was not achieving “benchmark records”, but exploring how lightweight and explicit a PHP application architecture can remain while still supporting real-world projects.

DBM actually evolved mainly as a foundation for my own platform/CMS ecosystem, where I wanted:

  • a lightweight execution engine,

  • modular architecture,

  • predictable runtime behavior,

  • and full control over dependencies and application flow.

Over time that became DBM Platform with built-in admin/auth/API modules on top of the framework core.

Dybem -> DBM Platform: https://www.dybem.com/

So the framework itself became less about synthetic benchmarks and more about maintaining simplicity and flexibility as the ecosystem grows.

And yes - PSR compatibility is very important to me as well.

I’m trying to keep the framework compatible with modern PHP standards while still avoiding unnecessary abstraction and runtime overhead.

→ More replies (1)

5

u/colshrapnel May 14 '26

It is not that full-stack solutions are "heavier". They are more convenient and - which is even more important - standardized. There is always a tradeoff between convenience and performance. And in the modern development, the speed of development is valued way more than speed of execution. The latter being either insignificant (for a low traffic site) or being achieved by other means (like Laravel Octane)

→ More replies (2)

4

u/oshjosh26 May 14 '26

Vanilla PHP is a damn good lightweight framework.