livewire-mercure-demo.mp4
This demo showcases the use of Mercure (a modern substitute for WebSockets) to send real-time public and private messages in a Laravel Livewire application—no page refresh or polling required.
- Clone the repository:
git clone https://github.com/benbjurstrom/livewire-mercure-demo.git
- Enter the directory:
cd livewire-mercure-demo
- Install php dependencies:
composer install
- Install node dependencies:
npm install && npm run build
- Start the docker environment:
./vendor/bin/sail up
- Run migrations and seeders:
./vendor/bin/sail artisan migrate:fresh --seed
- Access the app at
http://localhost/login
. Login with[email protected]
andpassword
. - Use the Artisan command
php artisan message:send
to send a message.
This repo was created from a fresh Laravel 10 install with the Laravel Breeze package added. All additional configuration needed to get Mercure up and running can be found in this diff: https://github.com/benbjurstrom/livewire-mercure-demo/commit/ab62d8276df652750b77ac04183b010724c5561d
Note: This demo uses a patched version of Livewire.