saritasa/laravel-notifications-api

2.0.1 2022-08-26 10:52 UTC

This package is auto-updated.

Last update: 2024-08-26 15:20:20 UTC


README

PHP Unit PHP CodeSniffer Release PHPv Downloads

通知API的实现。

Laravel 5.x

安装 saritasa/laravel-notifications-api

$ composer require saritasa/laravel-notifications-api

如果您使用Laravel 5.4或更早版本,或者5.5+版本且禁用了包发现,请在 config/app.php 中添加 NotificationsApiServiceProvider

'providers' => array(
    // ...
    Saritasa\PushNotifications\NotificationsApiServiceProvider::class,
)

对于定制,某些库实体使用 artisan publish 命令

  • php artisan vendor:publish --tag=saritasa-notifications-swagger

    用于添加API描述的yaml文件(注意:别忘了将它们添加到paths.yaml中)

  • php artisan vendor:publish --tag=saritasa-notifications-migrations

    用于定制迁移

  • php artisan vendor:publish --tag=saritasa-notifications-config

    用于定制配置文件

或者直接使用以发布所有可定制的资源 php artisan vendor:publish --tag=saritasa-notifications

模型(数据库映射)

NotificationType

通知类型可能的描述,以及它是否默认开启或关闭。

必填字段

  • id (int)
  • name (string)
  • defaultOn (boolean)

NotificationSetting

用户的个人设置值 - 指定通知类型是否开启或关闭。

必填字段

  • id (int)
  • userId (int)
  • notificationTypeId (int)
  • isOn (boolean)

贡献

  1. 创建分支,检出它
  2. 像往常一样本地开发。 代码必须遵循 PSR-1PSR-2 - 运行 PHP_CodeSniffer 以确保代码遵循风格指南
  3. 为添加的功能添加单元测试 并运行 PHPUnit 以确保所有测试通过
  4. 更新 README.md 来描述新功能或更改功能
  5. 将更改描述添加到 CHANGES.md 文件。使用 语义版本控制 规范来确定下一个版本号。
  6. 准备好后,创建拉取请求

创建快捷方式

如果您已安装 GNU Make,则可以使用以下快捷方式

  • make cs(替代 php vendor/bin/phpcs)- 使用 PHP_CodeSniffer 运行静态代码分析以检查代码风格
  • make csfix(替代 php vendor/bin/phpcbf)- 使用 PHP_CodeSniffer 自动修复代码风格违规(例如,PSR-2代码格式违规),在可能的情况下
  • make test(替代 php vendor/bin/phpunit)- 使用 PHPUnit 运行测试
  • make install - 替代 composer install
  • make all 或仅 make 不带参数 - 连续执行上述描述的 安装cs测试 任务 - 项目将被组装,使用代码检查工具进行检查,并通过单个命令进行测试

资源