项目作者: nodes-php

项目描述 :
Push manager made for Laravel
高级语言: PHP
项目地址: git://github.com/nodes-php/push.git
创建时间: 2015-11-08T15:27:03Z
项目社区:https://github.com/nodes-php/push

开源协议:

下载


Push

A Push manager to send push messages to mobile devices from your project.

Total downloads
Monthly downloads
Latest release
Open issues
License
Star repository on GitHub
Watch repository on GitHub
Fork repository on GitHub
Travis tests
codecov
StyleCI

📝 Introduction

At Nodes we send a lot of push messages from our mobile API’s.

Therefore we’ve created a push manager, which makes the job a lot easier

📦 Installation

To install this package you will need:

  • Laravel 5.2+
  • PHP 7.0+

You must then modify your composer.json file and run composer update to include the latest version of the package in your project.

  1. "require": {
  2. "nodes/push": "^2.0"
  3. }

Or you can run the composer require command from your terminal.

  1. composer require nodes/push:^2.0

🔧 Setup

In Laravel 5.5 or above, service providers and aliases are automatically registered. If you’re using Laravel 5.5 or above, skip ahead directly to Publish config files.

Setup service provider in config/app.php

  1. Nodes\Push\ServiceProvider::class

Setup alias in config/app.php

  1. 'Push' => Nodes\Push\Support\Facades\Push::class

Publish config files

  1. php artisan vendor:publish --provider="Nodes\Push\ServiceProvider"

If you want to overwrite any existing config files use the --force parameter

  1. php artisan vendor:publish --provider="Nodes\Push\ServiceProvider" --force

⚙ Usage

Global method

  1. push();

Example

  1. push()->setMessage('test')
  2. ->setExtra([
  3. 'id' => 1
  4. ])
  5. ->send();

Function on provider used to send push

  1. // Add data to push
  2. setMessage(string $message) : ProviderInterface; // Message (Required)
  3. setExtra(array $extra) : ProviderInterface; // Array of key/value (int, float, bool, string)
  4. // Segment push for userId / userIds
  5. setAlias(string $alias) : ProviderInterface;
  6. setAliases(array $aliases) : ProviderInterface;
  7. // Segment push for channels, like "weekend_news" or "daily_news"
  8. setChannels(array $channels) : ProviderInterface;
  9. setChannel(string $channel) : ProviderInterface;
  10. // Send push, before this is executed nothing will get send
  11. send() : array; //In request, return array of results from provider
  12. // Advanced configs
  13. setIOSBadge($iOSBadge) : ProviderInterface; //Control badge on iOS app icon
  14. setSound(string $sound) : ProviderInterface; // Custom sound
  15. removeSound() : ProviderInterface; // Remove custom sound
  16. setIosContentAvailable(bool $iosContentAvailable) : ProviderInterface; // Should not go in notification center
  17. setAndroidData(array $androidData) : ProviderInterface; // Add more extra for android only, android can handle 8 times more data in push than iOS
  18. setAndroidDeliveryPriorityHigh() : ProviderInterface; // Make sure the Android device wakes up when push is recieved
  19. setAppGroup(string $appGroup) : ProviderInterface; // Change your default-app-group in run time. Handy for white labeling

🏆 Credits

This package is developed and maintained by the PHP team at Nodes Agency

Follow Nodes PHP on Twitter Tweet Nodes PHP

📄 License

This package is open-sourced software licensed under the MIT license