saritasa / laravel-notifications-api
通知API的实现
2.0.1
2022-08-26 10:52 UTC
Requires
- php: >=7.0
- illuminate/database: ^5.4 || ^6.0
- illuminate/http: ^5.4 || ^6.0
- illuminate/notifications: ^5.4 || ^6.0
- illuminate/support: ^5.4 || ^6.0
- saritasa/eloquent-custom: ^1.0
Requires (Dev)
- phpunit/phpunit: ^6.0
- squizlabs/php_codesniffer: ^3.5
README
通知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)
贡献
- 创建分支,检出它
- 像往常一样本地开发。 代码必须遵循 PSR-1, PSR-2 - 运行 PHP_CodeSniffer 以确保代码遵循风格指南
- 为添加的功能添加单元测试 并运行 PHPUnit 以确保所有测试通过
- 更新 README.md 来描述新功能或更改功能
- 将更改描述添加到 CHANGES.md 文件。使用 语义版本控制 规范来确定下一个版本号。
- 准备好后,创建拉取请求
创建快捷方式
如果您已安装 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、测试 任务 - 项目将被组装,使用代码检查工具进行检查,并通过单个命令进行测试