PHPackages                             riazxrazor/laravel-sweet-alert - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. riazxrazor/laravel-sweet-alert

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

riazxrazor/laravel-sweet-alert
==============================

Laravel package to show beautiful flash message

1.2.1(8y ago)21.0k2MITJavaScriptPHP ^5.3.3 || ^7.0

Since Feb 26Pushed 8y ago2 watchersCompare

[ Source](https://github.com/riazXrazor/LaravelSweetAlert)[ Packagist](https://packagist.org/packages/riazxrazor/laravel-sweet-alert)[ RSS](/packages/riazxrazor-laravel-sweet-alert/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)DependenciesVersions (12)Used By (0)

LaravelSweetAlert
=================

[](#laravelsweetalert)

[![GitHub Author](https://camo.githubusercontent.com/23f23867c476757fa85285a3050f07818d9640a8f64e256ec8ffdd4d7bb35ac8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d407269617a5872617a6f722d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/riazXrazor)[![GitHub release](https://camo.githubusercontent.com/b010e0d61c2352dd3e4e8878d715915d39d78190103fbed4c5a12ead745b5c7f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7269617a7872617a6f722f6c61726176656c7377656574616c6572742e7376673f7374796c653d666c61742d737175617265)](https://github.com/riazXrazor/LaravelSweetAlert/releases)[![GitHub license](https://camo.githubusercontent.com/284abc2457e43105474084b07c8e4b43d2ec2e7ce75b2a12aa02f3c57cd13221/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c25323076332d626c75652e7376673f7374796c653d666c61742d737175617265)](https://raw.githubusercontent.com/riazXrazor/LaravelSweetAlert/master/LICENSE)[![GitHub issues](https://camo.githubusercontent.com/fc130485894fccbe48d484d31e4ab64a922388ce456d9749bccbcdedc8114628/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f7269617a5872617a6f722f4c61726176656c5377656574416c6572742e7376673f7374796c653d666c61742d737175617265)](https://github.com/riazXrazor/LaravelSweetAlert/issues)

[![StyleCI](https://camo.githubusercontent.com/995c76eb1f9757b786359033f466fa0157b0fb24bfe7fd2fc36f7ffc71bd2cc7/68747470733a2f2f7374796c6563692e696f2f7265706f732f38333233333435302f736869656c64)](https://styleci.io/repos/83233450)

Laravel package to show beautiful flash message. Its basically a laravel wrapper for the beautiful and very good and useful jquery plugin [SweetAlert2](https://limonte.github.io/sweetalert2). Using `SweetAlert2 : 7.13.0`

Installation
------------

[](#installation)

Open `composer.json` and add this line below.

```
{
    "require": {
        "riazxrazor/laravel-sweet-alert": "^1.2.0"
    }
}
```

Or you can run this command from your project directory.

```
composer require riazxrazor/laravel-sweet-alert
```

Configuration
-------------

[](#configuration)

Open the `config/app.php` and add this line in `providers` section.

```
Riazxrazor\LaravelSweetAlert\LaravelSweetAlertServiceProvider::class,
```

add this line in the `aliases` section.

```
'LaravelSweetAlert' => Riazxrazor\LaravelSweetAlert\LaravelSweetAlert::class
```

Publish public `assets` by running this command.

```
php artisan vendor:publish --tag=public --force
```

Place this blade directive at the end before `` section of the html of layout blade template

```
@LaravelSweetAlertJS
```

Usage
-----

[](#usage)

You can use the function like this.

```
// in the controller method
\LaravelSweetAlert::setMessageSuccess("flash message")
\LaravelSweetAlert::setMessageError("error flash message")
\LaravelSweetAlert::setMessageSuccessConfirm("flash message")
\LaravelSweetAlert::setMessageErrorConfirm("error flash message")

// for more customization

 LaravelSweetAlert::setMessage([
                        'title' => 'Successful',
                        'text' => $text,
                        'timer' => 2000,
                        'type' => 'success',
                        'showConfirmButton' =>false
                    ]);

\LaravelSweetAlert::setMessage([
        'title' => 'Auto close alert!',
        'text' => 'I will close in 5 seconds.',
        'timer' =>  5000,
            'onOpen' => '() => { swal.showLoading() }',
        ],

        // second argument array of js function each element will be a then to swal

        ['(result) => {
  if (
    // Read more about handling dismissals
    result.dismiss === swal.DismissReason.timer
  ) {
    console.log("I was closed by the timer")
  }
}'],

// third argument is a catch function to the promise of swal

'(e)=>console.log(e)');
```

when the when is redirected to another route a beautiful flash message appears

for more customization options please refer to [SweetAlert2](https://limonte.github.io/sweetalert2), just pass the js object as associative array in the `setMessage` method.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

Every ~61 days

Recently: every ~8 days

Total

7

Last Release

2994d ago

### Community

Maintainers

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

---

Top Contributors

[![riazXrazor](https://avatars.githubusercontent.com/u/13194363?v=4)](https://github.com/riazXrazor "riazXrazor (32 commits)")

### Embed Badge

![Health badge](/badges/riazxrazor-laravel-sweet-alert/health.svg)

```
[![Health](https://phpackages.com/badges/riazxrazor-laravel-sweet-alert/health.svg)](https://phpackages.com/packages/riazxrazor-laravel-sweet-alert)
```

###  Alternatives

[myxtype/eos-client

php eos client offline sign eosphp-ecc

462.1k](/packages/myxtype-eos-client)[helori/laravel-seo

SEO tools to insert meta and structured-data in laravel projects

134.9k](/packages/helori-laravel-seo)

PHPackages © 2026

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