nodes / push
此包已被废弃,不再维护。未建议替代包。
为Laravel制作的推送管理器
2.2.17
2019-07-03 12:23 UTC
Requires
- guzzlehttp/guzzle: 6.x
- laravel/framework: 5.1.*||5.2.*||5.3.*||5.4.*||5.5.*||5.6.*||5.7.*||5.8.*
- nodes/core: 1.1.*
Requires (Dev)
- orchestra/testbench: ~3.4
- phpunit/phpunit: ~5.7
- dev-master
- 2.2.17
- 2.2.16
- 2.2.15
- 2.2.14
- 2.2.13
- 2.2.12
- 2.2.11
- 2.2.10
- 2.2.9
- 2.2.8
- 2.2.7
- 2.2.6
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.x-dev
- 1.0.1
- 1.0.0
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-develop
- dev-bugfix/wns-does-not-support-named-users
- dev-feature/named-users
- dev-Casperhr-patch-1
- dev-feature/push
- dev-content-available-test
This package is auto-updated.
Last update: 2024-05-17 19:27:36 UTC
README
这是一个推送管理器,用于从您的项目中向移动设备发送推送消息。
📝 简介
在 Nodes,我们从移动API发送大量的推送消息。
因此,我们创建了一个推送管理器,使这项工作变得更加容易
📦 安装
要安装此包,您需要
- Laravel 5.2+
- PHP 7.0+
然后您必须修改您的 composer.json
文件并运行 composer update
以将包的最新版本包含到项目中。
"require": { "nodes/push": "^2.0" }
或者您可以从终端运行 composer require 命令。
composer require nodes/push:^2.0
🔧 配置
在Laravel 5.5或更高版本中,服务提供者和别名将自动注册。自动注册。如果您使用的是Laravel 5.5或更高版本,请直接跳转到 发布配置文件。
在 config/app.php
中设置服务提供者
Nodes\Push\ServiceProvider::class
在 config/app.php
中设置别名
'Push' => Nodes\Push\Support\Facades\Push::class
发布配置文件
php artisan vendor:publish --provider="Nodes\Push\ServiceProvider"
如果您想覆盖任何现有的配置文件,请使用 --force
参数
php artisan vendor:publish --provider="Nodes\Push\ServiceProvider" --force
⚙ 使用
全局方法
push();
示例
push()->setMessage('test')
->setExtra([
'id' => 1
])
->send();
用于发送推送的功能在提供者上
// Add data to push
setMessage(string $message) : ProviderInterface; // Message (Required)
setExtra(array $extra) : ProviderInterface; // Array of key/value (int, float, bool, string)
// Segment push for userId / userIds
setAlias(string $alias) : ProviderInterface;
setAliases(array $aliases) : ProviderInterface;
// Segment push for channels, like "weekend_news" or "daily_news"
setChannels(array $channels) : ProviderInterface;
setChannel(string $channel) : ProviderInterface;
// Send push, before this is executed nothing will get send
send() : array; //In request, return array of results from provider
// Advanced configs
setIOSBadge($iOSBadge) : ProviderInterface; //Control badge on iOS app icon
setSound(string $sound) : ProviderInterface; // Custom sound
removeSound() : ProviderInterface; // Remove custom sound
setIosContentAvailable(bool $iosContentAvailable) : ProviderInterface; // Should not go in notification center
setAndroidData(array $androidData) : ProviderInterface; // Add more extra for android only, android can handle 8 times more data in push than iOS
setAndroidDeliveryPriorityHigh() : ProviderInterface; // Make sure the Android device wakes up when push is recieved
setAppGroup(string $appGroup) : ProviderInterface; // Change your default-app-group in run time. Handy for white labeling
🏆 致谢
此包由 Nodes Agency 的PHP团队开发和维护
📄 许可证
此包是开源软件,根据 MIT 许可证 许可