dev-master
9999999-devJPush integration to laravel framework
MIT
The Requires
The Development Requires
by Zhang Zhi
JPush integration to laravel framework
JPush integration to laravel framework, (*1)
Execute the following command to get the latest version of the package:, (*3)
composer require snowwolf007cn/laravel-jpusher
ServiceProvider will be attached automatically, (*4)
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)
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)
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)
JPush integration to laravel framework
MIT