Search by

microweber-packages / microweber-notification

boksiora

Standalone Laravel package for database notifications, mail channel delivery, admin notification management, and mail logs. Extracted from Microweber CMS so it can be reused in any Laravel application.

Package info

github.com/microweber-packages/microweber-notification

Homepage

pkg:composer/microweber-packages/microweber-notification

Statistics

Installs: 34

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-03 14:28 UTC

This package is auto-updated.

Last update: 2026-11-03 17:07:20 UTC


README

Standalone Laravel package for database notifications, the AppMailChannel mail delivery channel, admin notification management, and mail logs. Extracted from the Microweber CMS Notification package so it can be reused in any Laravel application (with dependent packages such as mail-sender).

Install

composer require microweber-packages/microweber-notification

Register the service provider (auto-discovery is supported):

$app->register(\MicroweberPackages\Notification\Providers\NotificationServiceProvider::class);

Publish config, views, and migrations:

php artisan vendor:publish --tag=microweber-notification-config
php artisan vendor:publish --tag=microweber-notification-views
php artisan vendor:publish --tag=microweber-notification-migrations
php artisan migrate

Usage

Notifications manager

use MicroweberPackages\Notification\Facades\Notifications;
// or
use MicroweberPackages\Notification\Services\NotificationsManager;

NotificationsManager::save([
    'module' => 'shop',
    'rel_type' => 'cart_orders',
    'rel_id' => 1,
    'title' => 'You have a new order',
    'description' => 'A new order was placed',
]);

$count = notifications_manager()->get_unread_count();
// or notification_unread_count();

App mail channel

use MicroweberPackages\Notification\Channels\AppMailChannel;
use Illuminate\Notifications\Notification;

class WelcomeNotification extends Notification
{
    public function via($notifiable): array
    {
        return ['database', AppMailChannel::class];
    }
}

Models

use MicroweberPackages\Notification\Models\Notification;
use MicroweberPackages\Notification\Models\NotificationMailLog;

Notification::query()->whereNull('read_at')->count();
NotificationMailLog::create([
    'type' => 'Welcome',
    'notifiable_type' => 'user',
    'notifiable_id' => 1,
]);

Config

See config/microweber-notification.php.

Key Description
admin_user_model Eloquent model for admin notifiables
admin_column / admin_value Query constraint for admins (is_admin = 1 by default)
load_admin_routes Register admin HTTP routes
admin_route_prefix Prefix (default admin, or CMS helper when present)
admin_middleware Middleware stack for admin routes

Dependent packages

Optional:

  • tucker-eric/eloquentfilter — enables Notification::filter() for admin listing

Tests

composer test
# or from monorepo root:
./vendor/bin/phpunit --testsuite=MicroweberNotification

PHPStan

composer analyse
# or from monorepo root:
composer analyse -- packages/microweber-notification/src