2017 © Pedro Peláez
 

library laravel-jpusher

JPush integration to laravel framework

image

snowwolf007cn/laravel-jpusher

JPush integration to laravel framework

  • Monday, May 7, 2018
  • by snowwolf007cn
  • Repository
  • 1 Watchers
  • 2 Stars
  • 53 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 96 % Grown

The README.md

laravel-jpusher

JPush integration to laravel framework, (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Table of Contents

Installation

Composer

Execute the following command to get the latest version of the package:, (*3)

composer require snowwolf007cn/laravel-jpusher

Laravel

>= laravel5.5

ServiceProvider will be attached automatically, (*4)

Broadcaster

Config JPush Broadcaster

Add following code into your config/broadcasting.php under 'connection', (*5)

'jpush' => [
    'driver' => 'jpush',
    'app_key' => env('JPUSH_APP_KEY'),
    'master_secret' => env('JPUSH_MASTER_SECRET'),
],

fill your app key and secret in .env, (*6)

Set Audience

Audiences are mapped to channels in laravel, and you can config channels like this., (*7)

Broadcast::channel('all', function ($user, $id) {
    return true;
});

Broadcast::channel('tag.{tag_name}', function ($user, $id) {
    return true;
});

examples above set two channels for diffrent audience configuration, All and Tag, (*8)

Add Payload

Platforms, Notifications, Message and Options are send to broadcaster as payload in an array, which will be serialized in json and send to server.Platforms are default to 'all', i.e., (*9)

/**
 * Add payload to broadcast.
 */
public function broadcastWith()
{
    return [
        'message' => [
            'msg_content' => 'Hi,JPush',
            'content_type' => 'text',
            'title' => 'msg',
        ],
    ];
}

Read more on how to broadcasting event and JPush API, (*10)

The Versions

07/05 2018

dev-master

9999999-dev

JPush integration to laravel framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zhang Zhi