Skip to main content
This guide will walk you through installing and configuring Laravel Chorus in your Laravel application. You’ll have real-time synchronization working in under 10 minutes.

Prerequisites

Before you begin, ensure you have:
  • Laravel 10+ application
  • PHP 8.1+
  • Laravel Reverb (for WebSocket connections)
  • Node.js 18+ (for frontend integration)

Quick Start

The easiest way to get started is by using the React Starter Kit for Chorus. This starter kit is based on Laravel’s React Starter Kit, but with Chorus pre-installed and a simple example included, so you can hit the ground running. To get started, run this command in your favorite terminal:
You will be prompted to set up Reverb as your broadcast driver and set up Chorus’s dependencies. Now run the following in your favorite terminal in the root project directory:
After installing and running the servers, log in/sign up to the dashboard as a user. You will now see that we have set up the users table to be synced. Now to test how awesome sync is, open a terminal in the root project directory and enter the following:
Did you see that? Our data is updated in real-time! Try experimenting with creating and deleting users, and watch the users update live in the browser. Chorus also provides a method to write data locally and subsequently sync the data to the server. You can learn more by looking at the Write Path documentation.

How to install into an existing Laravel App

Step 1: Install the Package

Install Laravel Chorus via Composer:

Step 2: Run the Installer

The installer sets up everything you need:
This command will:
  • Publish configuration files
  • Create the harmonics database migration
  • Set up Laravel Reverb (if not already installed)
  • Generate TypeScript utilities in resources/js/chorus
  • Configure broadcasting settings
  • Install the appropriate Chorus package for your chosen framework

Step 3: Run Migrations

Create the harmonics table:

Configuration

Database Configuration

The config/chorus.php file contains all Chorus settings:

Your First Synchronized Model

Step 1: Add the Harmonics Trait

Add the Harmonics trait to any model you want to synchronize:

Step 2: Create Write Actions

Generate write actions for your model:
This creates action classes in app/Actions/WriteActions/:
Register the write actions in your model:

Step 3: Update Model Configuration

Add your model to the config/chorus.php:

Frontend Integration

Step 1: Add the Chorus Provider

Wrap your app with the Chorus provider:

Step 2: Use Data in Components

Use Chorus hooks to access synchronized data:

Start the Servers

Start Reverb

Start the Laravel Reverb WebSocket server:

Start Your Frontend

Testing Your Integration

  1. Open multiple browser tabs to your application
  2. Create, update, or delete messages in one tab
  3. Watch changes appear instantly in other tabs
  4. Go offline and make changes - they’ll sync when back online

Next Steps

Harmonics Trait

Add the Harmonics trait to your models

React Integration

Build real-time React components

Write Actions

Master server-side write operations and validation

Advanced Features

Set up multi-tenancy and advanced features

Troubleshooting

Ensure Reverb is properly configured and running. Check the browser console for connection errors. You can also run reverb with the --debug flag to see when harmonic events get fired.
Verify the model has the Harmonics trait. Check server logs for errors.
Ensure write actions have allowOfflineWrites => true and proper validation rules.
Run php artisan chorus:generate --types to regenerate TypeScript definitions.

Congratulations! You now have Laravel Chorus running in your application. Your users will experience instant, real-time updates with full offline support.