GithubHelp home page GithubHelp logo

xinge's Introduction

Tencent Xinge PHP SDK for Laravel

Latest Version on Packagist Software License Total Downloads

腾讯移动推送(XinGe Push,即 XGPush)

This package makes it easy to send notifications using Tencent Xinge with Laravel.

Installation

You can install this package via composer:

composer require freyo/xinge

Next add the service provider and facade to your config/app.php:

...
'providers' => [
    ...
    Freyo\Xinge\ServiceProvider::class,
],
'aliases' => [
    ...
    'Xinge' => Freyo\Xinge\Facade::class,
],
...

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Setting up the Xinge service

You will need to create a Xinge app in order to use this channel. Within in this app you will find the access id and access secret. Place them inside your .env file. In order to load them, add this to your config/services.php file:

...
'xinge' => [
    'android' => [
        'access_id'    => env('XINGE_ANDROID_ACCESS_ID'),
        'secret_key'   => env('XINGE_ANDROID_ACCESS_KEY')
    ],
    'ios' => [
        'access_id'    => env('XINGE_IOS_ACCESS_ID'),
        'secret_key'   => env('XINGE_IOS_ACCESS_KEY')
    ],
]
...

This will load the Xinge app data from the .env file. Make sure to use the same keys you have used there like XINGE_IOS_ACCESS_ID.

Usage

Notification

Follow Laravel's documentation to add the channel to your Notification class.

Example: AndroidPushSingleAccount, iOSPushSingleAccount.

Facade

Xinge::android()->PushSingleDevice($deviceToken, $message);
Xinge::android()->PushSingleAccount($deviceType, $account, $message);
Xinge::android()->PushAllDevices($deviceType, $message);
Xinge::android()->PushTags($deviceType, $tagList, $tagsOp, $message);
Xinge::android()->PushAccountList($deviceType, $accountList, $message);

Xinge::ios()->PushSingleDevice($deviceToken, $message, $environment = 0);
Xinge::ios()->PushSingleAccount($deviceType, $account, $message, $environment = 0);
Xinge::ios()->PushAllDevices($deviceType, $message, $environment = 0);
Xinge::ios()->PushTags($deviceType, $tagList, $tagsOp, $message, $environment = 0);
Xinge::ios()->PushAccountList($deviceType, $accountList, $message, $environment = 0);

FULL API DOCUMENT

License

The MIT License (MIT). Please see License File for more information.

xinge's People

Contributors

freyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xinge's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.