Blog Detail

06

Oct
Simple & Easy Flash Notifications from PHP and Javascript cover image

arrow_back Simple & Easy Flash Notifications from PHP and Javascript

PHPFlasher gives a straightforward way to give feedback messages on the current or the next page to users with a flashing system.
The flashing system basically makes it possible to record a message and store it within the session so that it can be retrieved when needed.

Php Flasher

PHP Flasher helps you to add flash notifications to your PHP projects. This library was developed with the idea that you should be able to add flash notifications to your application with ease and with few lines of code. No application-wide rewrites and no big investments upfront.

Why use PHP Flasher?

PHPFlasher supports many notification libraries: tailwindcss, bootstrap, toastr.js, sweet alert 2, pnotify, noty, notyf, and even shows desktop notifications.

This library is designed, so you can take full control when creating your notifications :

  • Show various notifications simultaneously
  • Render notifications easily from javascript with a small footprint
  • LTR and Dark-mode support
  • Limit the number of displayed notifications
  • Show Desktop notifications for Linux, macOS, Windows
  • Framework-agnostic with implementations for Laravel and Symfony
  • Autocomplete for PHPSTORM
  • You can always create an adapter yourself
  • …and more

Installation

Quick start guide for installing the PHPFlasher from CDN or npm.

To pull in the PHPFlasher via CDN, grab the latest version from jsdelivr.

<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher@1.1.1/dist/flasher.min.js"></script>

npm

To install PHPFlasher from npm, use the following command:

npm i @flasher/flasher

Usage

import flasher from "@flasher/flasher";

window.flasher = flasher; // only if you want to use it globally

flasher.error("Oops! Something went wrong!");
flasher.warning("Are you sure you want to proceed ?");
flasher.success("Data has been saved successfully!");
flasher.info("Welcome back");

or if you are using a CDN like this:

<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher@1.1.1/dist/flasher.min.js"></script>
<script>
    flasher.error("Oops! Something went wrong!");
    flasher.warning("Are you sure you want to proceed ?");
    flasher.success("Data has been saved successfully!");
    flasher.info("Welcome back");
</script>

By following the above-given instructions you can learn the basic use of Php Flasher. But if you want to dig more you can visit its detailed documentation and View the source code on Github.

Published at : 06-10-2022

Author : Rizwan Aslam
AUTHOR
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch your project

Launch project