# Laravel Octane with RoadRunner

> Deploy Laravel Octane with RoadRunner: install via Composer, set `php artisan octane:start --server=roadrunner`, configure workers. Full setup in 5 minutes.

Laravel Octane with RoadRunner
-------------------------------

RoadRunner is a high-performance PHP application server written in Go. When combined with Laravel Octane, it provides excellent performance by keeping your application in memory between requests.

### What is RoadRunner?

RoadRunner is an alternative to FrankenPHP that offers:

- A mature, battle-tested PHP application server
- Written in Go for optimal performance
- Built-in support for workers, queues, and more
- Excellent memory management

### Setting up Octane with RoadRunner

Follow these steps to deploy your Laravel application with Octane and RoadRunner:

<ol>
<li>Navigate to your application's <strong>Settings</strong> tab</li>
<li>Find the <strong>PHP runtime</strong> section</li>
<li>Select <strong>FrankenPHP (Octane)</strong> as the runtime</li>
<li>Save your settings</li>
</ol>

### Install Laravel Octane and RoadRunner

Before deploying, install Laravel Octane and the RoadRunner packages in your application and commit the changes to your repository:

<pre><code>composer require laravel/octane spiral/roadrunner-cli spiral/roadrunner-http
php artisan octane:install --server=roadrunner</code></pre>

### Configure build commands

Add the RoadRunner binary download to your build commands:

<ol>
<li>Go to your application's <strong>Build configuration</strong> section</li>
<li>Add the following command to your build commands:</li>
</ol>

<pre><code>./vendor/bin/rr get-binary</code></pre>

This downloads the RoadRunner binary during the build process.

### Set the start command

Configure the start command in your application settings:

<ol>
<li>Navigate to your application's <strong>Settings</strong> tab</li>
<li>Find the <strong>Start command</strong> field</li>
<li>Enter the following command:</li>
</ol>

<pre><code>php artisan octane:start --server=roadrunner --host=0.0.0.0 --port=8080</code></pre>

### Deploy your application

After configuring the runtime, build commands, and start command, deploy your application. The deployment will:

<ol>
<li>Install the Octane and RoadRunner packages</li>
<li>Download the RoadRunner binary</li>
<li>Start your application using the RoadRunner server</li>
</ol>

## Frequently asked questions

### What is the RoadRunner command for Laravel Octane?

Run `php artisan octane:start --server=roadrunner --host=0.0.0.0 --port=8080`. Set this as the start command in your application settings.

### How do I install Laravel Octane with RoadRunner?

Run `composer require laravel/octane spiral/roadrunner-cli`, then `php artisan octane:install --server=roadrunner`. Commit and redeploy.

### How many workers should I configure for RoadRunner?

Start with 4 workers per CPU core for typical Laravel workloads. Use the `--workers=N` flag to override the default. Tune based on memory headroom and request profile.

### When should I choose RoadRunner over Swoole or FrankenPHP?

RoadRunner is a strong middle ground when you want stable, battle-tested Go-based performance without Swoole's extension dependency. Pick FrankenPHP for the simplest setup with HTTP/2; pick Swoole for maximum raw throughput.
