Looking to hire Laravel developers? Try LaraJobs

laravel-notifyer maintained by ajaylove1shi

Description
A powerful, flexible Laravel notifyer (notification) package with multiple positions, five style variants, animated progress bars, pause-on-hover, action buttons, and a clean fluent builder API.
Author
Last update
2026/06/04 11:49 (dev-main)
License
Downloads
0

Comments
comments powered by Disqus

Laravel Notifyer

Latest Version on Packagist Total Downloads Laravel Version PHP Version Software License

A powerful, flexible Laravel notifyer (notification) package with multiple positions, five style variants, animated progress bars, pause-on-hover, action buttons, and a clean fluent builder API.

View Live Demo

Features

  • 5 notifyer types — Success, Danger, Warning, Info, Primary
  • 6 positions — Top/Bottom × Left/Center/Right
  • Auto-dismiss with configurable duration
  • Pause-on-hover — timer freezes while the cursor is over the notifyer
  • Progress bar animation tracks the countdown
  • Custom action buttons in the footer
  • Custom icons via Line Awesome (or any CSS icon font)
  • Custom CSS classes per notifyer
  • Persistent (non-dismissing) notifiers
  • Session-based — works with the standard POST → redirect → GET pattern
  • Facade (Notifyer::success(...)) and helper (notifyer()->success(...))
  • Array-based configuration — configure an entire notifyer in a single method call
  • Publishable config, views, and assets
  • Responsive — adapts gracefully on mobile screens

Requirements

Laravel PHP
8.x ^8.0
9.x ^8.0
10.x ^8.1
11.x ^8.2
12.x ^8.2
13.x ^8.2

Installation

1. Installation

composer require ajaylove1shi/laravel-notifyer

Manual Registration (Optional)

If package auto-discovery is disabled in your application, or you prefer explicit registration, follow the setup steps below based on your framework version.

For Laravel 11, 12, and 13

Open bootstrap/providers.php and append the provider class to the returned array:

<?php

return [
    App\Providers\AppServiceProvider::class,
    AjayLove1shi\LaravelNotifyer\NotifyerServiceProvider::class, // Add this line
];

For Laravel 8, 9, and 10

Step 1 — Register the service provider

Open config/app.php and add the provider class to your providers array:

'providers' => [
    // ... Other Service Providers ...
    AjayLove1shi\LaravelNotifyer\NotifyerServiceProvider::class,
],

Step 2 — Register the Facade alias

If you want to use the short Notifyer:: name instead of importing the full namespace in your classes, append the alias hook into the aliases array inside config/app.php:

'aliases' => [
    // ... Other Aliases ...
    'Notifyer' => AjayLove1shi\LaravelNotifyer\Facades\Notifyer::class,
],

2. Publish assets

Publish the CSS, JS, and (optionally) config/views in one command:

php artisan vendor:publish --tag=laravel-notifyer

Individual publish tags are also available:

# Config only
php artisan vendor:publish --tag=laravel-notifyer-config

# Views only (so you can customise the Blade template)
php artisan vendor:publish --tag=laravel-notifyer-views

# CSS + JS only
php artisan vendor:publish --tag=laravel-notifyer-assets

This copies files to:

config/notifyer.php
public/vendor/notifyer/css/style.css
public/vendor/notifyer/js/script.js
resources/views/vendor/notifyer/generate.blade.php

3. Asset Integration

To include the necessary scripts, styles, and the runtime rendering layout engine, add the following references to your primary blade layout (e.g., layouts/app.blade.php):

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ config('app.name', 'Laravel') }}</title>

    <link rel="stylesheet" href="{{ config('notifyer.icon_cdn','') }}">

    <link rel="stylesheet" href="{{ asset('vendor/notifyer/css/style.css') }}">
</head>
<bodlaravel-notifyer s="app-content">
        @yield('content')
    </div>

    @include('laravel-notifyer::generate')

    <script src="{{ asset('vendor/notifyer/js/script.js') }}"></script>
</body>
</html>

Basiclaravel-notifyer r Funcation Example

Quick Syntax

notifyer()->success('Saved!',
    'Record stored successfully.'
);

Advanced Array Syntax

//Example with url.
notifyer()->success([
    'title'          => 'Saved!',
    'message'        => 'Record stored.',
    'position'       => 'bottom-right',
    'duration'       => 4000,
    'icon'           => 'la la-cloud-upload-alt',
    'notice'         => 'Auto-closes in 4 s',
    'actions'        => [
        [
            'label' => 'View Post',
            'url'   => '/posts/1',
            'class' => 'my-custom-btn',
        ],
    ],
    'class'          => 'my-custom-notifyer',
    'meta'           => '2 min ago',
    'pause_on_hover' => true,
    'progress_bar'   => true,
    'persistent'     => false,
]);

//Example with js function.
notifyer()->success([
    'title'          => 'Saved!',
    'message'        => 'Record stored.',
    'position'       => 'bottom-right',
    'duration'       => 4000,
    'icon'           => 'la la-cloud-upload-alt',
    'notice'         => 'Auto-closes in 4 s',
    'actions'        => [
        [
            'label' => 'View Post',
            'class' => 'my-custom-btn',
            'onclick' => 'myCustomJsFunction()',
        ],
    ],
    'class'          => 'my-custom-notifyer',
    'meta'           => '2 min ago',
    'pause_on_hover' => true,
    'progress_bar'   => true,
    'persistent'     => false,
]);

Fluent Chaining - Array-based configuration and fluent chaining can be combined.

notifyer()
    ->info([
        'title'       => 'System Update',
        'message'     => 'Maintenance begins tonight.',
        'duration'    => 3000,
        'position'    => 'bottom-right',
    ])
    ->position('top-center')
    ->icon('la la-tools')
    ->notice('Scheduled maintenance');

Facade Example

use AjayLove1shi\LaravelNotifyer\Facades\Notifyer;

Notifyer::success([
    'title'          => 'Saved!',
    'message'        => 'Record stored.',
    'position'       => 'bottom-right',
    'duration'       => 4000,
    'icon'           => 'la la-cloud-upload-alt',
    'notice'         => 'Auto-closes in 4 s',
    'actions'        => [
        [
            'label' => 'View Post',
            'url'   => '/posts/1',
            'class' => 'my-custom-btn',
        ],
    ],
    'class'          => 'my-custom-notifyer',
    'meta'           => '2 min ago',
    'pause_on_hover' => true,
    'progress_bar'   => true,
    'persistent'     => false,
]);

Full API Reference

Type Methods

Method Description
success(string|array $title, string $message = '') Green success notifyer
danger(string|array $title, string $message = '') Red danger notifyer
warning(string|array $title, string $message = '') Amber warning notifyer
info(string|array $title, string $message = '') Sky-blue info notifyer
primary(string|array $title, string $message = '') Indigo primary notifyer

Fluent Modifier Methods

Method Default Description
->position(string $position) 'top-right' One of: top-right, top-left, bottom-right, bottom-left, top-center, bottom-center
->duration(int $ms) 5000 Auto-dismiss delay in milliseconds. Minimum 500.
->icon(string $iconClass) type-default Full CSS class string, e.g. 'la la-rocket'
->notice(string $notice) '' Small text shown on the left side of the footer bar
->action(string $label, string $url = '', string $class = '', string $onclick = '') Append a footer action button. $url takes priority over $onclick.
->cssClass(string $class) '' Extra CSS class(es) added to the notifyer card element
->meta(string $meta) 'Just now' Timestamp / meta text shown in the header
->persistent() false Disable auto-dismiss — user must click ✕ to close
->withoutProgressBar() Hide the progress bar for this notifyer
->withoutPauseOnHover() Disable hover-pause for this notifyer

Available Array Options

Option Type Description
title string Notifyer title
message string Notifyer body text
position string Notifyer position
duration int Auto-dismiss duration in milliseconds
icon string Icon CSS class
notice string Footer notice text
actions array Footer action buttons
class string Additional CSS classes
meta string Header meta text
pause_on_hover bool Pause countdown while hovered
progress_bar bool Show progress bar
persistent bool Disable auto-dismiss

Values provided by fluent methods will override the corresponding array values.

Utility Methods

Method Description
notifyer()->clear() Remove all queued notifiers from the session
Notifyer::clear() Same, via facade

Main Configuration

After publishing the config file (config/notifyer.php), you can change package-wide defaults:

return [
    'position'       => 'top-right',    // Default position
    'duration'       => 5000,           // Default duration (ms)
    'pause_on_hover' => true,           // Pause timer on hover
    'progress_bar'   => true,           // Show progress bar
    'session_key'    => 'laravel_notifyer',
    'icon_cdn'       => 'https://maxst.icons8.com/vue-static/landings/line-awesome/line-awesome/1.3.0/css/line-awesome.min.css',
    'default_icons' => [
        'success' => 'la la-check-circle',
        'danger'  => 'la la-times-circle',
        'warning' => 'la la-exclamation-triangle',
        'info'    => 'la la-info-circle',
        'primary' => 'la la-bell',
    ]
];

Custom Icons

You can customize the default icon used for each notifyer type:

'icon_cdn'       => 'https://maxst.icons8.com/vue-static/landings/line-awesome/line-awesome/1.3.0/css/line-awesome.min.css',
'default_icons' => [
    'success' => 'la la-check-circle',
    'danger'  => 'la la-times-circle',
    'warning' => 'la la-exclamation-triangle',
    'info'    => 'la la-info-circle',
    'primary' => 'la la-bell',
],

These icons are used automatically whenever a notifyer is created without explicitly calling:

->icon('your-icon-class')

You may use any icon library (Line Awesome, Font Awesome, Bootstrap Icons, etc.) as long as the corresponding CSS is loaded in your application.

Usage Examples

Simple redirect flow

// PostController.php
public function store(Request $request): RedirectResponse
{
    $post = Post::create($request->validated());

    notifyer()->success('Post Created', 'Your post has been published.');

    return redirect()->route('posts.show', $post);
}

Persistent notifyer with multiple actions

notifyer()
    ->danger('Payment Failed', 'Your subscription could not be renewed.')
    ->persistent()
    ->notice('Action required')
    ->action('Update Card', route('billing.index'), 'btn-primary')
    ->action('Cancel Plan',  route('billing.cancel'));

Custom icon and bottom position

notifyer()
    ->info('New Message', 'You have a message from support.')
    ->icon('la la-envelope')
    ->position('bottom-right')
    ->duration(7000);

Array-based configuration

notifyer()->success([
    'title'          => 'Profile Updated',
    'message'        => 'Your profile information was saved successfully.',
    'position'       => 'top-right',
    'duration'       => 5000,
    'icon'           => 'la la-user-check',
    'notice'         => 'Changes are now live',
    'meta'           => 'Just now',
    'pause_on_hover' => true,
    'progress_bar'   => true,
    'actions'        => [
        [
            'label' => 'View Profile',
            'url'   => route('profile.show'),
        ],
    ],
]);

Using the Facade

use AjayLove1shi\LaravelNotifyer\Facades\Notifyer;

// PostController.php
public function store(Request $request): RedirectResponse
{
    $post = Post::create($request->validated());

    Notifyer::success([
        'title'          => 'Profile Updated',
        'message'        => 'Your profile information was saved successfully.',
        'position'       => 'top-right',
        'duration'       => 5000,
        'icon'           => 'la la-user-check',
        'notice'         => 'Changes are now live',
        'meta'           => 'Just now',
        'pause_on_hover' => true,
        'progress_bar'   => true,
        'actions'        => [
            [
                'label' => 'View Profile',
                'url'   => route('profile.show'),
            ],
        ],
    ]);

    return redirect()->route('posts.show', $post);
}

Live Demo

Try the interactive demo:

View Live Demo

Customising the Blade View

After publishing views (--tag=laravel-notifyer-views), the template lives at:

resources/views/vendor/notifyer/generate.blade.php

Edit it freely — the package will use your version instead of the built-in one.

Changelog

See CHANGELOG.md for recent changes.

Contributing

We welcome contributions from the community to make this library more stable and powerful! To submit changes:

  1. Fork the Project Repository.
  2. Create a feature branch tracking changes (git checkout -b feature/new-feature).
  3. Commit your changes safely (git commit -m 'Add some new-feature').
  4. Push code updates to your remote fork branch (git push origin feature/new-feature).
  5. Open a formal Pull Request against our development pipeline.

License

This software package is distributed under the conditions of the MIT License. For deep-dive conditions regarding reuse permissions, please check the LICENSE.md file included inside this source root folder.