jybtx/one-signal

One signal message push

v1.0.0 2019-10-21 03:32 UTC

This package is auto-updated.

Last update: 2025-04-07 09:32:11 UTC


README

测试消息推送用OneSignal

Installation

Composer

Execute the following command to get the latest version of the package:

composer require jybtx/one-signal

Laravel

>= laravel5.5

ServiceProvider will be attached automatically

Other

In your config/app.php add Jybtx\OneSignal\Providers\OneSignalServiceProvider::class to the end of the providers array:

'providers' => [
    ...
    Jybtx\\OneSignal\\Providers\\OneSignalServiceProvider::class,
],
'aliases'  => [
    ...
    "OneSignal": Jybtx\OneSignal\Faceds\OneSignalFacade::class,
]

Publish Configuration

php artisan vendor:publish --provider "Jybtx\OneSignal\Providers\OneSignalServiceProvider"

Usage

Register a message push ID for the user at registration time

use OneSignal;
OneSignal::registerPlayerId($identifier,$device_type,$device_os='',$device_model='');

Send messages to all users

OneSignal::sendMessageAllUsers($title,$txt,$time=null,$data = array());

Based on OneSignal PlayerIds sending

OneSignal::sendMessageSomeUser($title,$txt,$users,$data = array());

Cancellation notice

OneSignal::revokeMessage($notifId);

send Message For Tags

OneSignal::sendMessageUsingTags($title,$txt, $tags, $url = NULL, $data = NULL, $buttons = NULL, $subtitle = NULL);

View notifications

OneSignal::getNotifications($limit = NULL, $offset = NULL, $kind = 1 );

Generate a compressed CSV export of all of your current user data

OneSignal::getAllUserToExportCsv();

License

MIT