PHPackages                             synergitech/laravel-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. synergitech/laravel-alert

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

synergitech/laravel-alert
=========================

Construct custom alerts with Laravel

v2.0.5(2mo ago)678.2k↓30.3%2[1 PRs](https://github.com/SynergiTech/laravel-alert/pulls)MITPHPPHP ^8.0CI passing

Since Apr 30Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/SynergiTech/laravel-alert)[ Packagist](https://packagist.org/packages/synergitech/laravel-alert)[ RSS](/packages/synergitech-laravel-alert/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (15)Used By (0)

Laravel Alert
=============

[](#laravel-alert)

[![Tests](https://github.com/SynergiTech/laravel-alert/actions/workflows/test.yml/badge.svg)](https://github.com/SynergiTech/laravel-alert/actions/workflows/test.yml)

Inspired by [Easy Sweet Alert Messages for Laravel](https://github.com/uxweb/sweet-alert), this package provides a way of constructing alerts for the UI of your app.

Out of the box, this package supports [SweetAlert2](https://sweetalert2.github.io/) but its output can be tailored to support other plugins if you wish to create toasts alongside your SweetAlerts for example.

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

[](#installation)

```
composer require synergitech/laravel-alert

```

Laravel should be able to automatically detect the package and include it.

You should also make sure you have appropriately installed SweetAlert2 and/or any other notification package into your apps UI.

Quick Start
-----------

[](#quick-start)

You can use the facade or the helper function in your app to generate alerts containing a simple title, text, and type element.

```
use Alert;

...

Alert::message('Message', 'Optional 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()->message('Message', 'Optional 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');
```

To actually display the alert you will need to include a short snippet of code in your main view file. This package only outputs complete JSON objects into your session.

**Please note** this data is *put* into your session so you have to *pull* it to clear it out of the session. This allows you to not lose alerts from background ajax calls.

### Blade

[](#blade)

```
@if (Session::has('alert.sweetalert'))

        Swal.fire({!! Session::pull('alert.sweetalert') !!});

@endif
```

### Twig

[](#twig)

```
{% if session_has('alert.sweetalert') %}

        Swal.fire({{ session_pull('alert.sweetalert')|raw }});

{% endif %}
```

Advanced Usage
--------------

[](#advanced-usage)

This package provides a builder-like syntax allowing you to customise the alert further. The following examples provide identical output.

```
alert()->warning('You need to complete extra fields', 'Unable to submit');

\Alert::warning('You need to complete extra fields')
    ->title('Unable to submit');

alert()->type('warning')
    ->message('You need to complete extra fields')
    ->title('Unable to submit');
```

You can customise the fields available by publishing the config to your application. Read the config file for more details.

```
php artisan vendor:publish --provider="SynergiTech\Alert\ServiceProvider"
```

### Multiple Output Types

[](#multiple-output-types)

If you specify a second output, for example to create a toast option, this library will always add **both** to the session *unless* you ask for a specific type (v2 only).

```
// in your controller

alert()->output('toast')->info('Please check your settings.');

// OR

alert()->as('toast')->info('Please check your settings.');
```

Example config:

```
// config/alert.php

'output' => [
    'sweetalert' => [
        'title' => 'title',
        'text' => 'text',
        'icon' => 'type',
    ],
    'toast' => [
        'text' => 'text',
        'icon' => 'type',
    ],
],
```

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance87

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 78.9% 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 ~209 days

Recently: every ~281 days

Total

13

Last Release

62d ago

Major Versions

v0.2.0 → v1.0.02020-08-10

v1.2.0 → v2.0.02022-05-19

PHP version history (3 changes)v0.1.0PHP &gt;=7.0.0

v1.1.0PHP ^7.1 || ^8.0

v2.0.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![willpower232](https://avatars.githubusercontent.com/u/1619102?v=4)](https://github.com/willpower232 "willpower232 (45 commits)")[![Josh-G](https://avatars.githubusercontent.com/u/487384?v=4)](https://github.com/Josh-G "Josh-G (11 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

laravelalert

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[prologue/alerts

Prologue Alerts is a package that handles global site messages.

3486.1M30](/packages/prologue-alerts)[masmerise/livewire-toaster

Beautiful toast notifications for Laravel / Livewire.

505550.3k6](/packages/masmerise-livewire-toaster)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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