kaveh/notification-service 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kaveh/notification-service

最新稳定版本:1.0.0

Composer 安装命令:

composer require kaveh/notification-service

包简介

README 文档

README

A customizable notification package for Laravel.

Installation

Run the following command to install the package:

composer require kaveh/notification-service

Configuration

  1. Register the Service Provider
    Add the following line to bootstrap/providers.php:

    Kaveh\NotificationService\NotificationServiceProvider::class,
  2. Update composer.json
    Add the following to the autoload section:

    "autoload": {
        "psr-4": {
            "Kaveh\\NotificationService\\": "vendor/kaveh/notification-service/src/"
        }
    }

    Then, run:

    composer dump-autoload
  3. Migrate Notification Tables
    Run the following command to create necessary database tables:

    php artisan notification:migrate
  4. Extend the User Model
    Replace the default Laravel Authenticatable import in your User model:

    Before:

    use Illuminate\Foundation\Auth\User as Authenticatable;

    After:

    use Kaveh\NotificationService\Abstracts\Authenticatable;

    And add this method in your model:

    public function getId()
     {
         return $this->id;
     }
  5. Notification Configuration

    • Notification Type: Define the notification type, e.g., user_login, order_created, etc.
    • Notification Channel: Specify the notification delivery method: email, sms, in-app, etc.
    • Notification Preferences:
      We recommend using an event-listener to automatically set user notification preferences upon registration. This determines whether a user has granted permission for notifications.

Usage

Create a New Notification

Run the following command to generate a notification class:

php artisan make:notification-service {name}

Send a Notification

To send a notification, use:

NotificationService::sendNotification(notificationClass, UserModel, NotificationType, ?array data = []);

Enjoy using Laravel Notification Service! 🚀

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-02-17