Laravel package to launch toast notifications.

Overview

Laravel package to launch toast notifications.

Latest Stable Version Total Downloads Latest Unstable Version License

This package provides assistance when using toast notifications. Using the iziTOAST package, which allows us to launch elegant and responsive notifications, having the facility to apply a number of configurations that you will find available on their official site .

REQUIREMENTS

INSTALLATION VIA COMPOSER

Step 1: Composer

Run this command line in console.

composer require tonystore/livewire-notification

Step 2: Include component

Add the iziTOAST CDN styles and script, and the component containing the script to launch the notifications.

... @livewireScripts ... ... //INSERT COMPONENT //OR @component('livewire-notification::components.toast') @endcomponent ">
    
 "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/iziToast.min.css" rel="stylesheet" type="text/css" />


  
    ...
    @livewireScripts
    ...
    
    ...

    //INSERT COMPONENT

       

    //OR

    @component('livewire-notification::components.toast') @endcomponent
  

Publish Config File

php artisan vendor:publish --provider="Tonystore\LivewireNotification\LivewireNotificationProvider" --tag="config"

Default configuration

//config/livewire-notification

return [
    'toast' => [
        'title' => '', //Defaut Title
        'position' => 'topRight', //Defaut Position
        'timeout' => 3000, //Display Time
        'modal' => null, //Very important, it defines if an event is triggered to close a Bootstrap modal.
    ],

Usage

Now, in any Livewire component, you can launch notifications. To launch a notification you can choose between the different types available:

  • success
  • info
  • error
  • warning

Example 1

Launch a simple notification with a personalized message.

$this->alert(
        'success',
        'Example of notification.',
        );
        

Example 2

Example of notification with modal event.

$this->alert('info','Example of notification with modal event', [
        'modal' => '#hideModal'
    ]
);

To use more configurations, you can check the documentation on their official site .

You might also like...
📨 Facebook Notifications Channel for Laravel
📨 Facebook Notifications Channel for Laravel

Facebook Notifications Channel for Laravel This package makes it easy to send notifications using the Facebook Messenger with Laravel. Contents Instal

Push Notifications using Laravel
Push Notifications using Laravel

laravel-push-notification Push Notifications using Laravel PushNotification::send(['deviceToken1', 'deviceToken2',..], 'Notification Message', 'Action

✈️ Whatsapp Notifications Channel for Laravel

Whatsapp Notifications Channel for Laravel This package makes it easy to send Whatsapp notification using Venom API with Laravel. This package was cre

Send Firebase push notifications with Laravel php framework.

FCM Notification Channel for Laravel Send Firebase push notifications with Laravel php framework. Installation You can install this package via compos

Notion.so notifications channel for Laravel

Installation composer require astroshippers/notion-notification-channel Usage Inside eloquent model: public function routeNotificationForNotion(): arr

Event subscriber for Laravel notifications.
Event subscriber for Laravel notifications.

Laravel Notification Event Subscriber This package allows you to run any kind of actions while a notification is being sent or after it has been sent

Standalone PHP library for easy devices notifications push.

NotificationPusher Standalone PHP library for easy devices message notifications push. Feel free to contribute! Thanks. Contributors Cédric Dugat (Aut

:computer: Send notifications to your desktop directly from your PHP script
:computer: Send notifications to your desktop directly from your PHP script

About JoliNotif JoliNotif is a cross-platform PHP library to display desktop notifications. It works on Linux, Windows or MacOS. Requires PHP = 7.2 (

A very lightweight library to handle notifications the smart way.
A very lightweight library to handle notifications the smart way.

NAMSHI | Notificator Notificator is a very simple and lightweight library to handle notifications the smart way. It took inspiration from other librar

Comments
  • Redirect Button on the notification

    Redirect Button on the notification

    Hello there,

    I was trying to create a simple redirect button on the notification and looking at the documentation of Toast this is not easy with the current package.

    I got it working localy by changing the package, I had this in mind:

    Livewire.on('success', function(alert) {
          if (alert.modal !== null) {
              modalHide(alert.modal)
          }
          iziToast.success(Object.assign({}, {
                  title: alert.options.title !== null &&
                  alert.options.title !== void 0 ? alert.options.title : '',
                  message: alert.message !== null &&
                  alert.message !== void 0 ? alert.message : '',
                  buttons: alert.options.redirect_button !== void 0 ? [
                      ['<button>' + alert.options.redirect_button.title + '</button>', function (instance, toast) {
                          window.location.href = alert.options.redirect_button.route;
                      }]
                  ] : []
              },
              alert.options));
      });
    

    This way u can add the following to the options:

    'options' => [
        'redirect_button' => [
            'route' => route('x', ['x' => $x]),
            'title' => 'x'
        ]
    ]
    

    This will result in a simple button that redirects u when clicked!

    If this is already possible with the current code, please let me know how, if not, maybe consider adding this to the repo?

    With kind regards, Kars Miesen

    opened by kmiesen 0
Releases(1.0.1)
Owner
Anthony Medina
Desarrollador en Laravel 7 y Vue
Anthony Medina
A Toast notification library for the Laravel TALL stack.

A Toast notification library for the Laravel TALL stack. You can push notifications from the backend or frontend to render customizable toasts with almost zero footprint on the published CSS/JS ????

John F 365 Jan 7, 2023
Larafirebase is a package thats offers you to send push notifications or custom messages via Firebase in Laravel.

Introduction Larafirebase is a package thats offers you to send push notifications or custom messages via Firebase in Laravel. Firebase Cloud Messagin

Kutia Software Company 264 Jan 7, 2023
A package to simplify automating future notifications and reminders in Laravel

Laravel Snooze Schedule future notifications and reminders in Laravel Why use this package? Ever wanted to schedule a future notification to go out at

Thomas Kane 720 Jan 7, 2023
Laravel package to enable sending push notifications to devices

Laravel Push Notification Package to enable sending push notifications to devices Installation Update your composer.json file to include this package

Davi Nunes 1.2k Sep 27, 2022
This package makes it easy to send notifications using RocketChat with Laravel 9.0+.

laravel-rocket-chat-notifications Introduction This package makes it easy to send notifications using RocketChat with Laravel 9.0+. Contents Installat

Team Nifty GmbH 25 Dec 1, 2022
This package makes it easy to send web push notifications with Laravel.

Web push notifications channel for Laravel This package makes it easy to send web push notifications with Laravel. Installation You can install the pa

Laravel Notification Channels 564 Jan 3, 2023
This package allows you to send notifications to Microsoft Teams.

Teams connector This package allows you to send notifications to Microsoft Teams. Installation You can install the package using the Composer package

skrepr 20 Oct 4, 2022
Laravel Security Notifications

This package adds security notifications to warn your users when significant security events occur so that they aren't the next victim of an attacker.

Anteris 5 Feb 8, 2022
Laravel Subscribable Notifications

Laravel Subscribable Notifications This package allows you to subscribe your app Users to your app Notifications and dispatch them without specifying

Andrés Santibáñez 132 Nov 10, 2022
Flexible Flash notifications for Laravel

Introduction Laravel Notify is a package that lets you add custom notifications to your project. A diverse range of notification design is available.

Arthur Monney 1.2k Dec 26, 2022