GithubHelp home page GithubHelp logo

laravel-jpush's Introduction

Laravel JPush

基于 jpush/jpush 3.6.6 版本(当前最新版本), 三分钟完成极光推送开发.

Install

composer require mitoop/laravel-jpush

Require

  • Laravel ^7.0

Configure

config/services里增加极光配置 :

    'jpush' => [
        // 极光 app kye 
        'app_key' => env('JPUSH_APP_KEY') 
        // 极光 master secret
        'master_secret' => env('JPUSH_MASTER_SECRET'), 
        // 仅对iOS有效 开发环境设置为false 生产环境设置为true
        'apns_production' => env('JPUSH_APNS_PRODUCTION', false), 
        // 接口请求日志文件 为 null 不记录日志
        'log_file' => env('JPUSH_LOG_FILE'), 
    ],

如果需要Facadeconfig/app.php alias 数组下增加

'JPush' => Mitoop\JPush\JPushServiceFacade::class,

Use

推送可以采用同步或异步任意一种方式(推荐异步)

一下代码示例假设配置了 JPush alias

同步推送

JPush::pushNow('别名', '通知', '附加信息');
JPush::pushNow(['别名数组'], '通知', '附加信息');
JPush::pushNow('all', '通知', '附加信息'); // 推送给所有人

异步推送

JPush::pushQueue('别名', '通知', '附加信息');
JPush::pushQueue(['别名数组'], '通知', '附加信息');
JPush::pushQueue('all', '通知', '附加信息'); // 推送给所有人

更多:

如果上面两种方式不能满足使用
尝试查看 `Mitoop\JPush\JPushService` 里面的方法可以组合链式调用

Tips

在极光后台查看推送历史的时候, 有个选择框, Web/Api,
通过包推送的是 `Api` 这种方式,但是默认值是 `Web`,查看的时候要切换一下

Links

http://docs.jiguang.cn/jpush/guideline/intro/

http://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/

极光文档我觉得是推送服务商里写的最好的文档

laravel-jpush's People

Contributors

mitoop avatar

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.