PHPackages                             lara-pack/livewire-sweetalert - 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. lara-pack/livewire-sweetalert

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

lara-pack/livewire-sweetalert
=============================

Livewire Sweetalert

v1.0.4(5mo ago)032MITPHP

Since Aug 22Pushed 5mo agoCompare

[ Source](https://github.com/bhagaskara/lara-pack-livewire-sweetalert)[ Packagist](https://packagist.org/packages/lara-pack/livewire-sweetalert)[ RSS](/packages/lara-pack-livewire-sweetalert/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (6)Used By (0)

Livewire Sweetalert
===================

[](#livewire-sweetalert)

[![Latest Version on Packagist](https://camo.githubusercontent.com/df467170a74e685a65a6d4e928f3a2796494b58d9172d257626c12dbd418112a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6172612d7061636b2f6c697665776972652d7377656574616c6572742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lara-pack/livewire-sweetalert)[![Total Downloads](https://camo.githubusercontent.com/315d8e0e8fb8b93c2b132fe7ba397ebd45674475fbefabc4dfc9661ce3bc3d89/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6172612d7061636b2f6c697665776972652d7377656574616c6572742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lara-pack/livewire-sweetalert)

This Laravel package provides an easy way to trigger [SweetAlert2](https://sweetalert2.github.io/) notifications from [Livewire v3](https://livewire.laravel.com/) or v4 components.

Requirements
------------

[](#requirements)

- PHP ^8.1
- Laravel ^10.0 or ^11.0
- Livewire ^3.0 or ^4.0
- SweetAlert2 (must be installed in your frontend assets)

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

[](#installation)

You can install the package via composer:

```
composer require lara-pack/livewire-sweetalert
```

The package will automatically register its Service Provider.

Frontend Preparation
--------------------

[](#frontend-preparation)

Ensure you have included the SweetAlert2 library in your main layout (usually `app.blade.php`).

You can use CDN:

```

```

Or install it via NPM:

```
npm install sweetalert2
```

Usage
-----

[](#usage)

You can use the `LaraPack\LivewireSweetalert\Alert` class inside your Livewire components.

### Success / Fail Notifications

[](#success--fail-notifications)

Use the `success` or `fail` methods to display simple informational messages.

```
use LaraPack\LivewireSweetalert\Alert;
use Livewire\Component;

class CreateUser extends Component
{
    public function save()
    {
        // Save logic...

        Alert::success($this, 'Success!', 'User data has been saved.');
    }

    public function handleError()
    {
        Alert::fail($this, 'Failed!', 'An error occurred while processing data.');
    }
}
```

### Confirmation Tool

[](#confirmation-tool)

Use the `confirmation` method to display a confirmation dialog that triggers other Livewire actions based on the user's choice.

```
use LaraPack\LivewireSweetalert\Alert;
use Livewire\Component;

class UserTable extends Component
{
    public function deleteConfirm($id)
    {
        Alert::confirmation(
            $this,
            Alert::ICON_WARNING,
            'Are you sure?',
            'Deleted data cannot be recovered!',
            'delete', // Event name if confirmed (Yes)
            'cancelDelete', // Event name if cancelled (No)
            'Yes, delete it!', // Confirmation button text (Optional)
            'Cancel' // Cancel button text (Optional)
        );
    }

    #[On('delete')]
    public function delete()
    {
        // Deletion logic...
        Alert::success($this, 'Deleted!', 'Data has been successfully deleted.');
    }

    #[On('cancelDelete')]
    public function cancelDelete()
    {
        // Optional: Logic if cancelled
    }
}
```

How It Works
------------

[](#how-it-works)

This package uses middleware to inject a JavaScript script that listens for Livewire events (`SwalInfo` and `SwalConfirm`). When you call a method in the `Alert` class, this package dispatches an event to the frontend which is then caught by the script to display SweetAlert.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance70

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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 ~46 days

Total

5

Last Release

166d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24548806?v=4)[bhagaskara](/maintainers/bhagaskara)[@bhagaskara](https://github.com/bhagaskara)

---

Top Contributors

[![bhagaskara](https://avatars.githubusercontent.com/u/24548806?v=4)](https://github.com/bhagaskara "bhagaskara (7 commits)")

### Embed Badge

![Health badge](/badges/lara-pack-livewire-sweetalert/health.svg)

```
[![Health](https://phpackages.com/badges/lara-pack-livewire-sweetalert/health.svg)](https://phpackages.com/packages/lara-pack-livewire-sweetalert)
```

###  Alternatives

[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

731189.9k16](/packages/tallstackui-tallstackui)[noerd/noerd

111.6k12](/packages/noerd-noerd)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21362.6k](/packages/ramonrietdijk-livewire-tables)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1422.0k5](/packages/team-nifty-gmbh-tall-datatables)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.8k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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