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

ActiveLibrary

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

Livewire Sweetalert

v1.0.4(2mo ago)011MITPHP

Since Aug 22Pushed 2mo 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 1mo ago

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

36

—

LowBetter than 82% of packages

Maintenance86

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

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

Every ~46 days

Total

5

Last Release

75d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/63814bcebe20646b82976951817f1210b6c06138037b49772b844af9a876116c?d=identicon)[bhagaskara](/maintainers/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

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[power-components/livewire-powergrid

PowerGrid generates Advanced Datatables using Laravel Livewire.

1.7k1.7M6](/packages/power-components-livewire-powergrid)[livewire/flux

The official UI component library for Livewire.

9385.0M85](/packages/livewire-flux)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[jantinnerezo/livewire-alert

This package provides a simple alert utilities for your livewire components.

8041.2M20](/packages/jantinnerezo-livewire-alert)[leandrocfe/filament-apex-charts

Apex Charts integration for Filament PHP.

4861.2M8](/packages/leandrocfe-filament-apex-charts)

PHPackages © 2026

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