/laravel-reverb

Showcasing all the scenarios you can explore with Laravel and Reverb in real-time.

Primary LanguagePHP

Exploring Real-Time Scenarios in Laravel with Reverb

With the recent integration of Reverb into the Laravel ecosystem, real-time features have become more accessible without the need for external services. In this project, I aim to explore various scenarios utilizing this capability.

Scenarios Overview:

  • Live Location Sharing: Enable real-time sharing of locations between drivers and passengers (client-to-client).
    • You can find the scenario description here. laravel-share-live-location
  • Notification Broadcasting: Trigger events and broadcast notifications to specific clients or presence channels.
    • You can find the scenario description here. notification
  • Real-Time Currency Market Updates: Broadcast real-time updates of currency market prices.
    • You can find the scenario description here. currency
  • Client-Side Data Persistence: Receive and persist user-provided information on the socket platform in real-time (coming soon).

Getting Started

Follow these steps to set up the project on your local environment:

Prerequisites

Before you begin, make sure you have the following prerequisites installed on your system:

Installation

  1. Clone the project from GitHub:

    git clone https://github.com/mohaphez/laravel-reverb.git
    cd laravel-reverb
  2. Copy the .env.example file and rename it to .env:

    cp .env.example .env
  3. Install the project dependencies using Composer:

    docker run --rm \
        -u "$(id -u):$(id -g)" \
        -v "$(pwd):/var/www/html" \
        -w /var/www/html \
        laravelsail/php82-composer:latest \
        composer install --ignore-platform-reqs --no-scripts
  4. Start the development environment using Docker Sail:

    ./vendor/bin/sail up -d
  5. Update the project dependencies using Composer (Important):

        ./vendor/bin/sail composer update
  6. Restart Docker Sail:

        ./vendor/bin/sail down && ./vendor/bin/sail up
  7. Generate an application key:

    ./vendor/bin/sail php artisan key:generate
  8. Run migrations the database:

    ./vendor/bin/sail php artisan migrate
  9. Run seed the database:

    ./vendor/bin/sail php artisan module:seed
  10. Run reverb server:

    ./vendor/bin/sail php artisan reverb:start --debug
  11. Install npm dependencies:

    ./vendor/bin/sail npm install 
    ./vendor/bin/sail npm run mars:install 
    
  12. Run vite:

    ./vendor/bin/sail npm run mars:dev

Accessing the Application

You can access the panel by opening your web browser and navigating to:

http://localhost/login

Default Admin Credentials

Default Driver Credentials

Default Passenger Credentials