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 withuser1@example.com
andpassword
. - Use the Artisan command
sail artisan message:send
to send a message.
This repo was created from a fresh Laravel 10 install with the Laravel Breeze package added. From there everything needed to get Mercure up and running can be found in this diff: https://github.com/benbjurstrom/livewire-mercure-demo/commit/220ec5118c107f3c1cef7ddbf73d058e4744d0de