Realtime Notification Module With Laravel & Pusher

Overview


About Noftiy Module

This module to organize the notification process in real time without need to reload page, using PHP language with Laravel framework and Pusher. The UI is designed simple and easy to use because the main purpose of the module is to learn sending notifications using Laravel Events and Laravel Broadcast that support Pusher ( built-in )

Tools used in Ui

Backend Language

Framework used

Third party

Demo

Demo

Features

  • 🕒 Realtime

  • 🌟 Simple Ui

  • 🖥️ Desktop Notification

  • 🧬 Easy to integrate with any application

Installation

  1. Create Account On Pusher

  2. Create New Channel with any name , ex: realNotify

  3. Clone repository on your localhost

  4. Copy .env.example then rename it to .env

    • Set BROADCAST_DRIVER in .env file ' = pusher '
     BROADCAST_DRIVER=pusher
     
    • Add your pusher licences
     PUSHER_APP_ID=
     PUSHER_APP_KEY=
     PUSHER_APP_SECRET=
     
  5. Edit \Public\js\main.js

    • find var pusher = new Pusher('--app-key--' & add yours
  6. run composer install

  7. run npm install

  8. run npm run dev

Installed Successfully

Apply Desktop Notification

  • Edit \Public\js\main.js

    • find new PNotify({ & enable desktop like this
      PNotify.desktop.permission();
      new PNotify({
      type: 'info',
      text: data.content,
      desktop: {desktop: true} 
      });
      

Code Summary

  • \app\Http\Controllers\HomeController.php
      public function pushNotification(Request $request)
      {
      	$content = $request->notify_content;
      	if(!empty($content)) {
      		event(new NewNotification($content));
      	}
      }
      
  • \app\Events\NewNotification.php
      public function __construct($content)
      {
          $this->content = $content;
      }
      public function broadcastOn()
      {
          return ['new-notification'];
      }
      
  • \Public\js\main.js
      // Subscribe to the channel we specified in our Laravel Event
      var channel = pusher.subscribe('new-notification');
      // Bind a function to a Event (the full Laravel class)
      channel.bind('App\\Events\\NewNotification', function (data) {
         
      });
      
You might also like...
Joy VoyagerDatatable module adds Yajra DataTable to Voyager.
Joy VoyagerDatatable module adds Yajra DataTable to Voyager.

Joy VoyagerDatatable This Laravel/Voyager module adds Yajra Async/Ajax DataTable to Voyager. By 🐼 Ramakant Gangwar. Prerequisites Composer Installed

A web app for detecting backend technologies used in a web app, Based on wappalyzer node module

About Techdetector This a web fingerprinting application, it detects back end technologies of a given domain by using the node module wappalyzer. And

Shell script for Git module deployment with include/exclude filters.

Deploy multiple Git repositories in an unique folder modgit is a shell script for deploying multiple Git repositories in root folder of any project, w

File manager module for the Lumen PHP framework.

Lumen File Manager File manager module for the Lumen PHP framework. Please note that this module is still under active development. NOTE: Branch 5.1 i

List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

⚡ Laravel Charts — Build charts using laravel. The laravel adapter for Chartisan.
⚡ Laravel Charts — Build charts using laravel. The laravel adapter for Chartisan.

What is laravel charts? Charts is a Laravel library used to create Charts using Chartisan. Chartisan does already have a PHP adapter. However, this li

Laravel Kickstart is a Laravel starter configuration that helps you build Laravel websites faster.

Laravel Kickstart What is Laravel Kickstart? Laravel Kickstart is a Laravel starter configuration that helps you build Laravel websites faster. It com

Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app
Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

Laravel Segment is an opinionated, approach to integrating Segment into your Laravel application.

Laravel Segment Laravel Segment is an opinionated, approach to integrating Segment into your Laravel application. Installation You can install the pac

Owner
Mohamed Magdy
Mohamed Magdy
Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.

TALL-stack form generator Laravel Livewire, Tailwind forms with auto-generated views. Support Contributions Features This is not an admin panel genera

TinaH 622 Jan 2, 2023
Enjoy realtime input validation by passing your rules in your input itself.

Laravel Realtime input Enjoy realtime input validation by passing your rules in your input itself. Requirments This package is tested with Laravel v8

Yemeni Open Source 50 Nov 20, 2022
Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud Messaging (FCM).

Laravel-FCM Introduction Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud M

Rahul Thapa 2 Oct 16, 2022
📲 SmsOffice.ge service with notification channel for Laravel

Laravel SmsOffice This package allows you to send SMS messages with SmsOffice.ge API You can send sms with notification class or directly with SmsOffi

Levan Lotuashvili 11 Dec 24, 2022
🔔 Flasher is a powerful and flexible flash notification system for PHP, Laravel, Symfony

A powerful and flexible flash notifications system for PHP, Laravel, Symfony ?? PHP Flasher helps you to add flash notifications to your PHP projects.

PHP Flasher 158 Jan 4, 2023
Module Management In Laravel

Laravel-Modules Laravel laravel-modules 5.4 ^1.0 5.5 ^2.0 5.6 ^3.0 5.7 ^4.0 5.8 ^5.0 6.0 ^6.0 7.0 ^7.0 8.0 ^8.0 nwidart/laravel-modules is a Laravel p

Nicolas Widart 4.6k Dec 29, 2022
Simple project to send bulk comma-separated emails using laravel and messenger module from quick admin panel generator.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Novath Thomas 1 Dec 1, 2021
Le module PrestaShop Dronic© permet très facilement d'ajouter à votre site Prestashop un configurateur de drone FPV !

Description Le module PrestaShop Dronic© permet très facilement d'ajouter à votre site Prestashop un configurateur de drone FPV ! Ce module utilise de

Theo 3 Nov 19, 2021
Module for PageBuilder Support for M2.4.3 and future versions.

Magento 2 DataPatchCreator Page Builder Compatibility Plugin Plugin for PageBuilder to remove encoding of HTML special characters done by Magento\Page

eCommerce Nanobots 4 Dec 27, 2022
webtrees module: enhanced clippings cart with more functions to add records to the clippings cart and to start actions on these records

webtrees module hh_clippings_cart_enhanced !!! This is an alpha version! Do not use it in a productive webtrees system! !!! This webtrees custom modul

Hermann Hartenthaler 1 Sep 18, 2022