PHPackages                             languaojs/viper-flasher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. languaojs/viper-flasher

ActiveLibrary

languaojs/viper-flasher
=======================

A SweetAlert2 Toast wrapper for ViperPHP and other PHP frameworks.

v0.1.0(4mo ago)01MITPHPPHP &gt;=8.0

Since Dec 31Pushed 4mo agoCompare

[ Source](https://github.com/languaojs/viper-flasher)[ Packagist](https://packagist.org/packages/languaojs/viper-flasher)[ RSS](/packages/languaojs-viper-flasher/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Viper Flasher 🐍
===============

[](#viper-flasher-)

A lightweight PHP library to handle flash messages using **SweetAlert2** toasts. Originally built for the ViperPHP framework, but compatible with any PHP project.

🚀 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require languaojs/viper-flasher
```

If you are using ViperPHP, run the command above in the root folder of your project.

📋 Requirements
--------------

[](#-requirements)

This library requires jQuery and SweetAlert2 to be present in your HTML template. Add these CDNs to your header or footer:

```

```

If you are using ViperPHP, you will configure these assets in your controller (see ViperPHP documentation in my GitHub repo).

🛠 Usage
-------

[](#-usage)

### 1. Initialize Session

[](#1-initialize-session)

Ensure that session\_start() is called at the beginning of your application. With ViperPHP, you do not need to do this.

### 2. Set a Flash Message

[](#2-set-a-flash-message)

Use the setFlash method in your Controller or logic:

```
use Viper\Flasher\Flasher;

// Parameters: type (success, error, info, warning), message
Flasher::setFlash('success', 'Data saved successfully!');
```

### 3. Fire the Flash Message

[](#3-fire-the-flash-message)

Call the flash() method in your view (ideally at the bottom of the body):

```

```

🎨 Toast Configuration
---------------------

[](#-toast-configuration)

By default, this library uses a SweetAlert2 Toast with the following settings:

- Position: Top-end
- Timer: 5000ms
- Progress Bar: Enabled
- Confirm Button: Disabled

📜 License
---------

[](#-license)

This project is licensed under the MIT License.

Created by Zainurrahman

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance76

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

132d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ccaadc46adc334525919a22595f6f46eb48140b578748cf36f76b0979623480e?d=identicon)[languaojs](/maintainers/languaojs)

---

Top Contributors

[![languaojs](https://avatars.githubusercontent.com/u/107660406?v=4)](https://github.com/languaojs "languaojs (2 commits)")

---

Tags

phptoastsweetalert2Flasherviperphp

### Embed Badge

![Health badge](/badges/languaojs-viper-flasher/health.svg)

```
[![Health](https://phpackages.com/badges/languaojs-viper-flasher/health.svg)](https://phpackages.com/packages/languaojs-viper-flasher)
```

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67792.6k16](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
