Laravel Octane Swoole

Laravel Octane and Homestead: letting them work together

With the advent of Laravel Octane, it’s possible to take the robust foundation of Laravel and inject it with high-octane performance, leveraging powerful server technologies like Roadrunner and Swoole.

Meanwhile, Laravel Homestead provides a hassle-free development environment to keep things smooth and consistent. In this post, we’ll explore integrating Laravel Octane into Laravel Homestead and the lessons learned from a developer’s journey to achieving this.

Setting up Swoole

We didn’t get Octane working on Roadrunner in our Homestead environment. That’s why we set up Swoole. Unlike the Laravel docs, we are installing it as an apt package. Thanks to this guide.

# Install Swoole as PHP extension
sudo apt install php8.2-swoole # Verify Swoole is loaded
php -m | grep swoole

Running Octane on Homestead

Set up Octane in your app according to the Laravel docs:

composer require laravel/octane

# select Swoole
php artisan octane:install

Here is where the magic happens. Once Swoole has been set up, you can start Laravel Octane within Homestead as follows:

php artisan octane:start --server=swoole --host="yourdomain.test" --port=8089

The above command tells Laravel Octane to use Swoole as the server, binds it to a specific domain accessible within Homestead, and sets the port to 8089 to avoid conflicts with other services. With this setup, local development becomes not just faster but smoother, with the reliable and reproducible environment that Homestead provides.

The Challenge with Roadrunner

One Twitter post documents the initial attempt to run Laravel Octane within the Laravel Homestead environment using Roadrunner.

Tweet: “Finally got Laravel Octane to play nice in Laravel Homestead. Pro tip – use the host and port-options” – Here, a fellow developer hints at the solution to a similar problem they faced.


When running via Roadrunner, Roadrunner gives this error:

ERROR  handle_serve_command: Function call error:
ERROR  serve error from the plugin *rpc.Plugin stopping execution, error: rpc_plugin_serve: address -784: invalid port

That is why we chose for Swoole

Deploying to Production: Laravel Forge and HTTPS

When it comes time to take your high-performance Laravel application to production, Laravel Forge is a natural choice for many developers. It simplifies the deployment process, and when combined with Laravel Octane, you can expect a snappy, robust production environment.

One crucial tip for deploying with Laravel Forge is to set the OCTANE_HTTPS environment variable to true in your production environment. It ensures that generated links within your application use HTTPS, reflecting the secure transactions typical in production setups:


This simple change helps maintain protocol consistency and ensures users enjoy the security benefits of HTTPS.


Laravel Octane breathes new life into high-performance web applications, and when paired with Laravel Homestead, the development process is as smooth as it is fast. While there may be configuration challenges, like the one encountered with Roadrunner, solutions like Swoole provide excellent alternatives.

By adapting to these tools and sharing experiences, we as a community enhance our collective knowledge and toolkit. The valuable combination of Laravel, Octane, Homestead, and Forge is a start to the power and flexibility available to modern PHP developers.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top