11 Sep 2023

تعرّف علي أفضل بوابات الدفع الالكتروني في المملكة السعودية

تعرّف علي أفضل بوابات الدفع الالكتروني في المملكة السعودية

تعرّف علي أفضل بوابات الدفع الالكتروني في المملكة السعودية

Laravel Real-Time Events on Windows (Local Server)

This article explains how to set up Laravel real-time events on Windows using a local development environment.

  • Windows + WSL (Ubuntu)
  • Redis as the broadcast queue
  • Laravel Broadcasting
  • Laravel Echo Server + Socket.IO

By the end, you will be able to broadcast events from Laravel and listen to them in real time on localhost.

1. Prerequisites

  • Windows 10/11
  • Administrator access
  • PHP 8.1+
  • Composer
  • Node.js & npm
  • Laravel project

2. Install Ubuntu using WSL

Open PowerShell as Administrator and run:

wsl --install

Restart if required and verify installation:

wsl -l -v

3. Install & Run Redis

sudo apt update && sudo apt upgrade -y
sudo apt install redis-server -y
sudo service redis-server start
redis-cli ping

Redis will be available on 127.0.0.1:6379.

4. Configure Laravel Broadcasting

Install Redis PHP extension:

sudo apt install php-redis -y

Enable broadcasting:

php artisan install:broadcasting

5. Start Laravel Echo Server

laravel-echo-server start

6. Important Notes

  • Always implement ShouldBroadcast
  • Define channels in routes/channels.php
  • Run queue worker

Conclusion

Using WSL, Redis, and Laravel Echo Server allows you to run real-time Laravel events locally on Windows with a production-like setup.

OUR BLOGS
Read our latest articles and posts on design, technology, marketing and loads more
إنشاء متجر إلكتروني في السعودية - نصائح لتفتح متجرك الإلكتروني
إنشاء متجر إلكتروني في السعودية - نصائح لتفتح متجرك الإلكتروني
11 Sep 2023