# Turn on Horizon and Reverb for a Laravel site

Run your background jobs with Horizon and its dashboard, and give visitors live updates with Reverb, each in one click from the site's Laravel page.

Every Laravel site has a **Laravel** tab. Its first two panels set up the two programs most Laravel apps add once they grow:

- **Horizon** runs and watches your background jobs, such as sending emails, and gives you a dashboard of them.
- **Reverb** gives your visitors live updates without reloading the page, such as a new chat message or an order status (technical name: WebSockets).

Each one is a single button. Fuzops first checks that your app is ready, then does the whole setup, and the page shows how it went.

## What you need

- A Laravel site that has been published at least once, so its files are on the server.
- For Horizon: `laravel/horizon` in your project, and Redis on the server (or a Redis your app already uses elsewhere).
- For Reverb: `laravel/reverb` in your project. Your developer adds it with `php artisan install:broadcasting --reverb`.

Fuzops never changes your code. When a package is missing, the page says exactly which one and what your developer runs; once they add it and you publish an update, the setup continues on its own.

## Steps

1. **Open the Laravel tab.** Open the site, then the **Laravel** tab. You can also use **Horizon and Reverb** in the site's quick actions menu.

2. **Look at what Horizon needs.** Under **Horizon**, each row of **What Horizon needs** shows **Ready**, **Needed** or **Good to have**, with the fix beside it. For **Jobs go to Redis**, choose **Set it for me** and Fuzops sets `QUEUE_CONNECTION=redis` (and the Redis lines it needs) in the settings file. For **Redis runs on this server**, choose **Install Redis** to open the server's Services.

3. **Turn on Horizon.** If the site already has a plain queue worker, keep **Stop the plain queue worker** ticked: Horizon runs the same Redis jobs, so keeping both only uses memory (a job never runs twice either way). Choose **Turn on Horizon**. The app is checked, then Horizon starts as a background process of the site.

4. **Choose where visitors connect for live updates.** Under **Reverb**, pick one:
   - **The site's own address (recommended)**: the same address and the same secure connection as your pages, with nothing extra to point anywhere.
   - **A separate address**, such as `ws.example.com`: keeps live connections apart. Point it at the server first; it is added to the site's other addresses and must be in the site's HTTPS certificate.
   - **The free preview address**, when the site has one: works before your own domain is ready.

5. **Turn on Reverb.** Check **Most connections at once** (it is sized for your server, and the page says the most this PHP can hold), then choose **Turn on Reverb**. Fuzops makes the app id, key and secret, writes them into the site's encrypted settings file with the address lines, `BROADCAST_CONNECTION=reverb` and the `VITE_REVERB_*` lines, lets live connections through on the site's web server, starts Reverb, and tests the connection. Lines already in the file keep their place, and keys made earlier are kept.

6. **Publish an update.** The browser part of your site reads the `VITE_REVERB_*` lines when its scripts are built, so your pages connect at the next update. The Reverb panel has **Publish update now**.

![The Reverb panel of a site's Laravel tab: where visitors connect, most connections at once, and what Reverb needs](https://internal.fuzops.com/docs-img/laravel-horizon-reverb.webp)

## What you should see

- **Horizon** shows **On**, its status (running, paused or stopped), the link to its dashboard and **Pause**, **Continue**, **Restart** and **Turn off**. Every update restarts it gently: the jobs that are running finish first, then the new code takes over.
- **Reverb** shows **On**, the address visitors' browsers connect to, the kind of connection, and **Connection test** with **Works: a browser can open a live connection.** The keys are not shown on the page, for safety.
- Both also appear under the server's **Background processes**.

## If it goes wrong

- **"Waiting for your app".** Something the setup needs is missing, and nothing was changed. The panel lists what, with the fix. After your developer adds it and you publish, the setup continues by itself; **Check again** looks right away.
- **The dashboard shows "403 Forbidden".** On a live site Laravel only opens the Horizon dashboard for people your app lets in, with the `viewHorizon` rule in your code. A 403 means the rule works: ask your developer to add your email address to it.
- **The dashboard has no charts.** They need **Scheduled tasks** turned on (lower on the same page) and `horizon:snapshot` in your app's schedule.
- **The connection test stops.** It says which step stopped: Reverb not running, the key, the web server, the address not finding the server, or HTTPS. **Restart** helps when the key changed while Reverb was running.
- **No HTTPS yet.** Live updates then use a plain connection. Once the site has HTTPS, the panel offers **Switch to HTTPS**.
- **A hand-written web server config.** Fuzops leaves it alone: the Reverb panel shows the lines to paste into it.
- **A site on several servers.** Horizon works. Reverb runs on one server, and sharing live connections across several servers is not offered.

## Turn them off

**Turn off** stops the program. For Reverb it also removes its lines from the web server settings, while the keys stay in the settings file, so turning it on again needs no new setup. Tick **Also remove the Reverb lines from the settings file** to take them out too: the rest of the file stays exactly as it was.

When you add a new Laravel site, **Set up Horizon** and **Set up Reverb** under **Options** do all of this after the first update. If the app is not ready yet, the site's page says what it is waiting for.
