This is a minimal Laravel application that demonstrates how to use AnyCable as a broadcasting and Echo backend.
You need PHP and Composer installed. Follow the official Laravel docs or just try the following command on MacOS:
/bin/bash -c "$(curl -fsSL https://php.new/install/mac/8.4)"
Follow the steps below to install and run the project successfully:
-
Install all PHP dependencies
composer install
-
Generate a key for your project
php artisan key:generate
-
Install all JavaScript dependencies
npm install
-
Run migrations
php artisan migrate --migrate
-
Run all services (that would download and run AnyCable server as well)
composer run dev
Go to localhost:8000/dashboard and log in using the following credentials:
user: [email protected]
pass: password
Try to submit a new status and see it updated in real-time in all open tabs.
You can also run this project with the default Laravel Reverb WebSocket server without any code changes. Just update your configuration as follows:
-
Set
BROADCAST_CONNECTION=reverbin the.env -
Replace
php artisan anycable:serverwithphp artisan reverb:startin the process list of thedevcommand in thecomposer.jsonfile.
MIT.
Based on this demo: https://github.com/novuhq/laravel-reverb-app