Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laranotify Laravel Package

coderatio/laranotify

Advanced Laravel notifications/alerts built on Bootstrap Notify/Growl. Chain fluent methods to show elegant on-screen messages, blockables, and notifications, with template customization and publishable sample views.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require coderatio/laranotify
    

    Publish the config file:

    php artisan vendor:publish --provider="Coderatio\Laranotify\LaranotifyServiceProvider"
    
  2. Basic Usage Include the package’s JS/CSS in your layout (e.g., resources/views/layouts/app.blade.php):

    @include('laranotify::notify')
    

    Trigger a notification in a controller:

    use Coderatio\Laranotify\Facades\Laranotify;
    
    Laranotify::success('Task completed!')->send();
    
  3. First Use Case Display a success message after form submission:

    // In your controller
    public function store(Request $request) {
        $validated = $request->validate([...]);
        // Save logic...
        Laranotify::success('Record saved successfully')->send();
        return redirect()->back();
    }
    

Implementation Patterns

Common Workflows

  1. Dynamic Notifications Pass variables to notifications for dynamic content:

    Laranotify::info("User {$user->name} logged in")->send();
    
  2. Alerts with Actions Use withButton() to add clickable buttons:

    Laranotify::warning("Session expired")
        ->withButton('Refresh', 'javascript:location.reload()')
        ->send();
    
  3. Blocking Notifications Prevent user interaction until dismissed:

    Laranotify::blockable('Update required', 'Please update your profile')
        ->send();
    
  4. Queueing Notifications Store notifications in the session for delayed display (e.g., after redirect):

    Laranotify::queue('success', 'Processing...')->send();
    

Integration Tips

  • Blade Integration Check for queued notifications in your layout:

    @if(session()->has('laranotify'))
        @include('laranotify::notify')
    @endif
    
  • API Responses Return notifications in JSON responses:

    return response()->json([
        'success' => true,
        'message' => Laranotify::success('Data fetched')->toArray()
    ]);
    
  • Custom Templates Override default views by publishing assets:

    php artisan vendor:publish --tag=laranotify-views
    

Gotchas and Tips

Pitfalls

  1. Session Dependency

    • Notifications rely on the session. Ensure SESSION_DRIVER is configured (e.g., file, database, or redis).
    • Fix: Add 'session' => ['driver' => 'file'] to .env if needed.
  2. JavaScript Conflicts

    • If using other notification libraries (e.g., Toast), ensure jQuery and Bootstrap are loaded before laranotify.js.
    • Fix: Load dependencies in this order:
      <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script>
      @include('laranotify::notify')
      
  3. Queued Notifications Not Showing

    • If notifications don’t appear after redirect, verify laranotify is added to the session middleware group in app/Http/Kernel.php:
      'web' => [
          \Illuminate\Session\Middleware\AuthenticateSession::class,
          // ... other middleware
          \Coderatio\Laranotify\Middleware\LaranotifyMiddleware::class,
      ],
      

Debugging Tips

  • Check Session Data Dump queued notifications in a route:

    Route::get('/debug-notify', function() {
        dd(session('laranotify'));
    });
    
  • Inspect Console Errors Look for missing jQuery/Bootstrap dependencies or conflicts with other plugins.

Extension Points

  1. Custom Icons Override icons in the config:

    'icons' => [
        'success' => 'fas fa-check-circle',
        'error'   => 'fas fa-times-circle',
    ],
    
  2. Add Notification Types Extend the Laranotify facade to support custom types:

    // In a service provider
    Laranotify::extend('custom', function($message) {
        return Laranotify::make('custom', $message, 'bg-primary');
    });
    
  3. Localization Translate messages using Laravel’s translation system:

    Laranotify::success(__('messages.task_completed'))->send();
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle