PHPackages                             mckenziearts/laravel-notify - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. mckenziearts/laravel-notify

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

mckenziearts/laravel-notify
===========================

Flexible flash notifications for Laravel

v3.2.0(2mo ago)1.7k1.1M↓12.7%198[2 PRs](https://github.com/mckenziearts/laravel-notify/pulls)5MITPHPPHP ^8.3CI passing

Since Nov 5Pushed 1mo ago31 watchersCompare

[ Source](https://github.com/mckenziearts/laravel-notify)[ Packagist](https://packagist.org/packages/mckenziearts/laravel-notify)[ Fund](https://www.paypal.com/paypalme/monneyarthur)[ GitHub Sponsors](https://github.com/mckenziearts)[ RSS](/packages/mckenziearts-laravel-notify/feed)WikiDiscussions 3.x Synced 1mo ago

READMEChangelog (10)Dependencies (22)Versions (27)Used By (5)

 [![Laravel Notify Banner](art/notify-banner.png)](art/notify-banner.png)

 [![Build Status](https://github.com/mckenziearts/laravel-notify/actions/workflows/tests.yml/badge.svg)](https://github.com/mckenziearts/laravel-notify/actions) [![Coding Standards](https://github.com/mckenziearts/laravel-notify/actions/workflows/quality.yml/badge.svg)](https://github.com/mckenziearts/laravel-notify/actions/workflows/quality.yml) [![Total Downloads](https://camo.githubusercontent.com/0240076e02b9069423f7cb6edf6ad316e42f31e0c1b66a6f6ae0e7f89fd00304/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d636b656e7a6965617274732f6c61726176656c2d6e6f74696679)](https://packagist.org/packages/mckenziearts/laravel-notify) [![Latest Stable Version](https://camo.githubusercontent.com/6a92c58e9e7033e0944089ec6014dce3c89c8294e40201d7c3f3b44b282e4fd5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d636b656e7a6965617274732f6c61726176656c2d6e6f74696679)](https://packagist.org/packages/mckenziearts/laravel-notify) [![License](https://camo.githubusercontent.com/01ec8ba788c60948c29d68c3d30fb7db2c166b8f307872356f2bcc93e5321150/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d636b656e7a6965617274732f6c61726176656c2d6e6f74696679)](https://packagist.org/packages/mckenziearts/laravel-notify)

Introduction
------------

[](#introduction)

Laravel Notify is a lightweight Laravel package for displaying backend-driven notifications in your application.

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

[](#installation)

You can install the package using composer

```
composer require mckenziearts/laravel-notify
```

You can publish the configuration file and assets by running:

```
php artisan vendor:publish --tag=notify-assets
php artisan vendor:publish --tag=notify-config
```

Option 1: With Tailwind CSS &amp; Alpinejs
------------------------------------------

[](#option-1-with-tailwind-css--alpinejs)

If your project already uses Tailwind CSS 4.x, follow these steps to integrate Laravel Notify directly into your build process.

### Step 1: Configure Tailwind to scan package files

[](#step-1-configure-tailwind-to-scan-package-files)

In your `resources/css/app.css`, add the package's Blade files to Tailwind's content sources using the `@source` directive:

```
@import "tailwindcss";

@source "../../vendor/mckenziearts/laravel-notify/resources/views/**/*.blade.php";
```

### Step 2: Import the JavaScript

[](#step-2-import-the-javascript)

In your `resources/js/app.js`, import Alpine.js if you haven't already:

```
import Alpine from 'alpinejs'
window.Alpine = Alpine
Alpine.start()
```

### Step 3: Add the notification component to your layout

[](#step-3-add-the-notification-component-to-your-layout)

In your main Blade layout file (e.g., `resources/views/layouts/app.blade.php`):

```

```

### Step 4: Build your assets

[](#step-4-build-your-assets)

```
npm run build
# or for development
npm run dev
```

**✅ Done!** Tailwind will automatically generate CSS for all the notification styles used in the package.

Option 2: Without Tailwind CSS
------------------------------

[](#option-2-without-tailwind-css)

If you don't use Tailwind CSS in your project, you can use the pre-compiled CSS and JavaScript files.

### Add directives to your layout

[](#add-directives-to-your-layout)

```
>

    Laravel Notify

    @notifyCss

    @notifyJs

```

**✅ Done!** The pre-compiled assets will be loaded from your `public/vendor/mckenziearts/laravel-notify/dist/` directory.

### Usage

[](#usage)

Within your controllers, before you perform a redirect call the `notify` method with a title.

```
public function store()
{
    notify()
        ->success()
        ->title('⚡️ Laravel Notify is awesome!')
        ->send();

    return back();
}
```

### Type of notifications

[](#type-of-notifications)

Laravel Notify actually display 5 types of notifications

1. `toast` notification, (The default notification for Laravel Notify)

```
notify()
    ->success()
    ->title('Welcome to Laravel Notify ⚡️')
    ->send();
```

2. `connectify` notification, example of basic usage

```
notify()
    ->model(NotificationModel::Connect)
    ->success()
    ->title('Connection Found')
    ->message('Success Message Here')
    ->send();
```

3. `drakify` (😎) notification, displays an alert only

```
// For success alert
notify()
    ->model(NotificationModel::Drake)
    ->success()
    ->send();
// or
notify()
    ->model(NotificationModel::Drake)
    ->error()
    ->send(); // for error alert
```

4. `smiley` notification, displays a simple custom toast notification using the smiley (😊) emoticon

```
notify()
    ->model(NotificationModel::Smiley)
    ->success()
    ->title('You are successfully reconnected')
    ->send();
```

5. `emotify` notification, displays a simple custom toast notification using a vector emoticon

```
notify()
    ->model(NotificationModel::Emotify)
    ->success()
    ->title('You are awesome, your data was successfully created')
    ->send();
```

### Setting a duration

[](#setting-a-duration)

By default, notifications are shown for 5 seconds before they're automatically closed. You may customize this using the `duration()` method:

```
notify()
    ->success()
    ->title('Saved successfully')
    ->duration(3000) // 3 seconds
    ->send();
```

If you'd like to make a notification stay open until the user manually closes it, you can set a very long duration:

```
notify()
    ->warning()
    ->title('Important notice')
    ->duration(999999) // ~16 minutes
    ->send();
```

You can also configure a default duration for all notifications in the `config/notify.php` file:

```
'timeout' => env('NOTIFY_TIMEOUT', 5000),
```

### Adding Actions to Notifications

[](#adding-actions-to-notifications)

You can add interactive actions to your notifications, allowing users to perform tasks directly from the notification. Actions support both navigation (redirecting to a URL) and execution (calling a controller action).

**Note:** Actions are supported only for the following notification models: `Toast`, `Connect`, `Smiley`, and `Emotify`. The `Drake` model does not support actions.

#### Basic Usage

[](#basic-usage)

```
use Mckenziearts\Notify\Action\NotifyAction;

notify()
    ->success()
    ->title('User deleted successfully')
    ->actions([
        NotifyAction::make()
            ->label('Undo')
            ->action(route('users.restore', $user->id)),
        NotifyAction::make()
            ->label('View All')
            ->url(route('users.index')),
    ])
    ->send();
```

#### URL Actions (Navigation)

[](#url-actions-navigation)

Use the `url()` method to redirect users to another page. This creates a simple link (GET request):

```
NotifyAction::make()
    ->label('View details')
    ->url(route('users.show', $user->id));
```

You can open URLs in a new tab using the `openUrlInNewTab()` method:

```
NotifyAction::make()
    ->label('Read documentation')
    ->url('https://laravel.com/docs')
    ->openUrlInNewTab();
```

#### Action Actions (Execution)

[](#action-actions-execution)

Use the `action()` method to execute a controller action. This sends an HTTP request (POST by default) to your controller:

```
NotifyAction::make()
    ->label('Restore')
    ->action(route('users.restore', $user->id));
```

You can specify the HTTP method using the `method()` method:

```
// DELETE request
NotifyAction::make()
    ->label('Delete permanently')
    ->action(route('users.force-delete', $user->id))
    ->method('DELETE');

// PUT request
NotifyAction::make()
    ->label('Update status')
    ->action(route('users.activate', $user->id))
    ->method('PUT');
```

If you don't specify a method, it defaults to `POST`.

#### Complete Example

[](#complete-example)

```
public function destroy(User $user)
{
    $user->delete();

    notify()
        ->success()
        ->title('User deleted')
        ->message('The user has been moved to trash')
        ->actions([
            NotifyAction::make()
                ->label('Undo')
                ->action(route('users.restore', $user->id))
                ->method('POST'),
            NotifyAction::make()
                ->label('View Trash')
                ->url(route('users.trash'))
                ->openUrlInNewTab(),
        ])
        ->send();

    return redirect()->route('users.index');
}
```

#### Custom Styling

[](#custom-styling)

You can customize the appearance of action buttons using the `classes()` method:

```
NotifyAction::make()
    ->label('Delete')
    ->action(route('users.delete', $user->id))
    ->method('DELETE')
    ->classes('text-red-600 hover:text-red-500 font-bold');
```

#### Important Notes

[](#important-notes)

- **Mutual Exclusivity**: You cannot use both `action()` and `url()` on the same action. Choose one or the other.
- **Method Restriction**: The `method()` function can only be used with `action()`. Using it with `url()` will throw an exception.
- **New Tab Restriction**: The `openUrlInNewTab()` function can only be used with `url()`. Using it with `action()` will throw an exception.
- **Auto-close**: When an action is executed successfully, the notification automatically closes.
- **CSRF Protection**: Action requests automatically include CSRF tokens and proper headers.
- **Supported Models**: Actions work with `Toast`, `Connect`, `Smiley`, and `Emotify` notification models only.

#### Preset Notifications

[](#preset-notifications)

If you have a specific notification that is used across multiple different places in your system, you can define it as a preset notification in your config file. This makes it easier to maintain commonly used notifications in one place. Read how to define preset messages in the [Config](#config) section below.

As an example, to use a preset notification you have defined called 'common-notification', use the following:

```
notify()->preset('common-notification')->send();
```

You can override any of the values that are set in the config if you need to. For example, this could be useful if you have a common notification across, but you want to change the icon in one particular place that it's used without having to manually write out a new notification.

To do this, simply pass in an array that has the key of the attribute that you want to override and the value you want to override it with.

As an example, we could override the 'title' of our 'common-notification' by using the following:

```
notify()->preset('common-notification', ['title' => 'This is the overridden title'])->send();
```

Config
------

[](#config)

Config file are located at `config/notify.php` after publishing NotifyServiceProvider. You can define preset notifications in the config file using the following structure:

```
use Mckenziearts\Notify\Enums\NotificationType;
use Mckenziearts\Notify\Enums\NotificationModel;

'preset-messages' => [
    'user-updated' => [
        'type'    => NotificationType::Success,
        'model'   => NotificationModel::Toast,
        'title'   => 'User Updated',
        'message' => 'The user has been updated successfully.',
    ],
    'user-deleted' => [
        'type'    => NotificationType::Success,
        'model'   => NotificationModel::Toast,
        'title'   => 'User Deleted',
        'message' => 'The user has been deleted successfully.',
    ],
],
```

The example above shows the config for two preset notifications: 'user-updated' and 'user-deleted'.

Credits
-------

[](#credits)

- [Arthur Monney](https://twitter.com/MonneyArthur)
- [All Contributors](../../contributors)

###  Health Score

72

—

ExcellentBetter than 100% of packages

Maintenance87

Actively maintained with recent releases

Popularity65

Solid adoption and visibility

Community38

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 71.1% 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 ~96 days

Recently: every ~23 days

Total

25

Last Release

60d ago

Major Versions

1.x-dev → v2.02020-08-24

2.x-dev → v3.02025-12-17

PHP version history (4 changes)v1.0PHP &gt;=7.1

v2.2PHP &gt;=7.4

v2.4PHP ~8.0

v3.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14105989?v=4)[Arthur Monney](/maintainers/Mckenziearts)[@mckenziearts](https://github.com/mckenziearts)

---

Top Contributors

[![mckenziearts](https://avatars.githubusercontent.com/u/14105989?v=4)](https://github.com/mckenziearts "mckenziearts (150 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (23 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (19 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![otatechie](https://avatars.githubusercontent.com/u/30342985?v=4)](https://github.com/otatechie "otatechie (2 commits)")[![nerg4l](https://avatars.githubusercontent.com/u/4079392?v=4)](https://github.com/nerg4l "nerg4l (1 commits)")[![ramonpego](https://avatars.githubusercontent.com/u/6185157?v=4)](https://github.com/ramonpego "ramonpego (1 commits)")[![rogermedico](https://avatars.githubusercontent.com/u/2758290?v=4)](https://github.com/rogermedico "rogermedico (1 commits)")[![ruban-s](https://avatars.githubusercontent.com/u/44894135?v=4)](https://github.com/ruban-s "ruban-s (1 commits)")[![shailesh-ladumor](https://avatars.githubusercontent.com/u/16555999?v=4)](https://github.com/shailesh-ladumor "shailesh-ladumor (1 commits)")[![spaantje](https://avatars.githubusercontent.com/u/477362?v=4)](https://github.com/spaantje "spaantje (1 commits)")[![Temian1](https://avatars.githubusercontent.com/u/39234980?v=4)](https://github.com/Temian1 "Temian1 (1 commits)")[![uydevops](https://avatars.githubusercontent.com/u/97681426?v=4)](https://github.com/uydevops "uydevops (1 commits)")[![akunbeben](https://avatars.githubusercontent.com/u/46495960?v=4)](https://github.com/akunbeben "akunbeben (1 commits)")[![youssef3wi](https://avatars.githubusercontent.com/u/21143371?v=4)](https://github.com/youssef3wi "youssef3wi (1 commits)")[![amrography](https://avatars.githubusercontent.com/u/9614340?v=4)](https://github.com/amrography "amrography (1 commits)")[![ash-jc-allen](https://avatars.githubusercontent.com/u/39652331?v=4)](https://github.com/ash-jc-allen "ash-jc-allen (1 commits)")[![CodeLover254](https://avatars.githubusercontent.com/u/15217384?v=4)](https://github.com/CodeLover254 "CodeLover254 (1 commits)")[![JoJo-Bear](https://avatars.githubusercontent.com/u/9674196?v=4)](https://github.com/JoJo-Bear "JoJo-Bear (1 commits)")

---

Tags

flash-messageslaravellaravel-packagenotificationstoastlaravelnotificationlaravel-notify

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mckenziearts-laravel-notify/health.svg)

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

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[brian2694/laravel-toastr

toastr.js for Laravel

136649.4k5](/packages/brian2694-laravel-toastr)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[gr8shivam/laravel-sms-api

A modern, flexible Laravel package for integrating any SMS gateway with REST API support

10138.4k](/packages/gr8shivam-laravel-sms-api)[ghanem/laravel-smsmisr

Send SMS and SMS Notification via SMS Misr for Laravel

194.8k](/packages/ghanem-laravel-smsmisr)

PHPackages © 2026

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