Supercharging Laravel Performance with Octane and FrankenPHP
Overview
boosts your application performance by serving requests using high-performance application servers. By keeping your application in memory, it eliminates the overhead of booting the framework on every request. The newest addition to the ecosystem is , a modern server written in that offers exceptional speed and features like automatic HTTPS. This integration represents a massive leap forward for developers seeking sub-millisecond response times.
Prerequisites
Before moving forward, ensure you have the following in your environment:
- 8.2 or higher
- for package management
- Basic familiarity with the directory structure
- A terminal environment capable of running binary files
Key Libraries & Tools
- : The core package that integrates high-performance servers with .
- : A modern app server built on top of the web server.
- : A testing framework focused on simplicity and speed.
- : A plugin for used to perform stress testing and performance benchmarking.
Code Walkthrough
First, initialize a new project. We skip the starter kits to keep the setup lean and choose for rapid prototyping.
laravel new my-octane-app
Next, install the package via . This provides the necessary scaffolding to bridge and .
composer require laravel/octane
Now, run the installation command. When prompted for the server type, select frankenphp. The installer automatically downloads the necessary binary for your architecture.
php artisan octane:install
Finally, fire up the server. You will receive a local URL where your application is now running in a persistent state.
php artisan octane:start
Syntax Notes
When using to verify performance, the syntax is remarkably clean. Running ./vendor/bin/pest stress http://localhost:8000 --concurrency=5 tells the plugin to hit the endpoint with five simultaneous users. Note how the CLI output provides real-time feedback on request duration and successful hits.
Practical Examples
In a standard setup, a single request might take 30-50ms to boot the framework. With and , benchmark results show response times as low as 0.93ms. This is ideal for high-traffic APIs or real-time dashboards where latency must be kept to an absolute minimum.
Tips & Gotchas
Since keeps your app in memory, global variables or static properties do not reset between requests. Always use dependency injection or the Octane::forget method to clear state. If you make code changes, remember that needs to restart to pick them up, or you can use the --watch flag during development.
- 27%路 products
- 19%路 products
- 12%路 products
- 8%路 products
- 8%路 products
- Other topics
- 27%

Laravel Octane & FrankenPHP 馃
WatchLaravel // 3:20
The official YouTube channel of Laravel, the clean stack for Artisans and agents. We will update you on what's new in the world of Laravel, from the framework to our products Cloud, Forge, and Nightwatch.