PHPackages                             germey/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. germey/sweetalert

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

germey/sweetalert
=================

Sweet Alert Extension used on Laravel

1252CSS

Since Jul 29Pushed 9y agoCompare

[ Source](https://github.com/Germey/LaravelSweetAlert)[ Packagist](https://packagist.org/packages/germey/sweetalert)[ RSS](/packages/germey-sweetalert/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Sweet Alert for Laravel
=======================

[](#sweet-alert-for-laravel)

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

[](#installation)

First, pull in the package through Composer.

```
"require": {
    "germey/sweetalert": "dev-master"
}
```

If using Laravel 5, include the service provider within `config/app.php`.

```
'providers' => [
    Germey\SweetAlert\SweetAlertServiceProvider::class
];
```

And, for convenience, add a facade alias to this same file at the bottom:

```
'aliases' => [
    'SweetAlert' => Germey\SweetAlert\SweetAlert::class
];
```

Usage
-----

[](#usage)

### With the Facade

[](#with-the-facade)

Within your controllers, before you perform a redirect...

```
public function store()
{
    SweetAlert::message('Robots are working!');

    return Redirect::home();
}
```

### With the Helper

[](#with-the-helper)

- `alert($message = null, $title = '')`

In addition to the previous listed methods you can also just use the helper function without specifying any message type. Doing so is similar to:

- `alert()->message('Message', 'Optional Title')`

Like with the Facade we can use the helper with the same methods:

```
alert()->message('Message', 'Optional Title');
alert()->basic('Basic Message', 'Mandatory Title');
alert()->info('Info Message', 'Optional Title');
alert()->success('Success Message', 'Optional Title');
alert()->error('Error Message', 'Optional Title');
alert()->warning('Warning Message', 'Optional Title');

alert()->basic('Basic Message', 'Mandatory Title')
    ->autoclose(3500);

alert()->error('Error Message', 'Optional Title')
    ->persistent('Close');
```

Within your controllers, before you perform a redirect...

```
/**
 * Destroy the user's session (logout).
 *
 * @return Response
 */
public function destroy()
{
    Auth::logout();

    alert()->success('You have been logged out.', 'Good bye!');

    return home();
}
```

For a general information alert, just do: `alert('Some message');` (same as `alert()->message('Some message');`).

By default, all alerts will dismiss after a sensible default number of seconds.

But no fear, if you need to specify a different time you can:

```
    // -> Remember!, the number is set in milliseconds
    alert('Hello World!')->autoclose(3000);
```

Also, if you need the alert to be persistent on the page until the user dismiss it by pressing the alert confirmation button:

```
    // -> The text will appear in the button
    alert('Hello World!')->persistent("Close this");
```

Finally, to display the alert in the browser, you may use (or modify) the view that is included with this package. Simply include it to your layout view:

```
>

    Document

        Welcome to my website...

    @include('sweetalert::alert')

```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

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

### Embed Badge

![Health badge](/badges/germey-sweetalert/health.svg)

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

###  Alternatives

[vildanbina/livewire-tabs

Laravel Livewire Tab Form component

505.1k](/packages/vildanbina-livewire-tabs)

PHPackages © 2026

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