microweber-packages / microweber-notification
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
pkg:composer/microweber-packages/microweber-notification
Requires
- php: ^8.2
- illuminate/auth: ^10.0|^11.0|^12.0|^13.0
- illuminate/bus: ^10.0|^11.0|^12.0|^13.0
- illuminate/config: ^10.0|^11.0|^12.0|^13.0
- illuminate/contracts: ^10.0|^11.0|^12.0|^13.0
- illuminate/database: ^10.0|^11.0|^12.0|^13.0
- illuminate/http: ^10.0|^11.0|^12.0|^13.0
- illuminate/mail: ^10.0|^11.0|^12.0|^13.0
- illuminate/notifications: ^10.0|^11.0|^12.0|^13.0
- illuminate/queue: ^10.0|^11.0|^12.0|^13.0
- illuminate/routing: ^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
- illuminate/view: ^10.0|^11.0|^12.0|^13.0
- microweber-packages/microweber-mail-sender: *
- microweber-packages/microweber-package: *
- microweber-packages/microweber-url: *
- spatie/laravel-package-tools: ^1.16
- tucker-eric/eloquentfilter: ^3.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/dusk: ^8.0|^9.0
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0
Suggests
- microweber-packages/mail-sender: Configures mail transport used by AppMailChannel
Provides
None
Conflicts
None
Replaces
- microweber-packages/notification: *
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
- microweber-packages/microweber-mail-sender — mail transport for
AppMailChanneland test mail
Optional:
tucker-eric/eloquentfilter— enablesNotification::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