An open API service indexing awesome lists of open source software.

https://github.com/jantinnerezo/livewire-alert

SweetAlert2 integration for Livewire
https://github.com/jantinnerezo/livewire-alert

alpinejs laravel livewire sweetalert2

Last synced: 24 days ago
JSON representation

SweetAlert2 integration for Livewire

Awesome Lists containing this project

README

        

# Livewire Alert

Build Status [![PHPStan Analysis](https://github.com/jantinnerezo/livewire-alert/workflows/PHPStan/badge.svg)](https://github.com/jantinnerezo/livewire-alert/actions) Total Downloads License

Livewire Alert is a Laravel Livewire package designed to integrate SweetAlert2 notifications seamlessly into Livewire projects. This package simplifies the process of displaying simple, customizable alerts to users, enhancing the interactivity and user experience of your Livewire projects.

You can check the interactive demo here: [livewire-alert.laravel.cloud](https://livewire-alert.laravel.cloud)

## Requirements
- PHP 8.1 or higher
- Laravel 10.x or higher
- Livewire 3.x
- Composer

## Installation

First, require the package with Composer:

``` bash
composer require jantinnerezo/livewire-alert
```

Optionally, if you want to customize the global configuration, you can publish the config file:

``` bash
php artisan vendor:publish --tag=livewire-alert:config
```

Next, install SweetAlert2 via npm or yan:

NPM
``` bash
npm install sweetalert2
```

Yarn
``` bash
yarn add sweetalert2
```

After installing SweetAlert2, import it into your `resources/js/app.js` file

``` js
import Swal from 'sweetalert2'

window.Swal = Swal
```

If you prefer not to use package manager installation, you can include SweetAlert2 directly via CDN. Add the following script to your Blade layout file `(e.g., resources/views/layouts/app.blade.php)` before the closing `