A Production-Ready Laravel Architecture with Traefik and FrankenPHP



This content originally appeared on DEV Community and was authored by Daniel, Petrica Andrei-Daniel

Laravel is a very performant framework, but a standard architecture has one big flaw derived from how PHP works: It has to rebuild the entire framework on every single request.

Even with optimizations, this process still takes 40 to 60 ms on my machine with PHP 8.4. Luckily, for years, the PHP and Laravel worlds have had a solution that dramatically reduces this load time: Laravel Octane and FrankenPHP. The booting time for the Laravel framework can drop to just 4 to 6 ms per request. Incredible, isn’t it?

Now, if you’re new to Laravel Octane or FrankenPHP, you may wonder: How is this possible?

The simple answer is that the framework is kept in memory. After FrankenPHP starts, Laravel is always ready to serve requests without a full reboot. The real explanation is more complex and out of scope for this article. If you’re curious, you can read the official Laravel Octane and FrankenPHP docs for a deeper dive.

read the full article at: DanielPetrica.com


This content originally appeared on DEV Community and was authored by Daniel, Petrica Andrei-Daniel