{"id":34672331,"url":"https://github.com/housemecn/jiguang-client-for-php","last_synced_at":"2025-12-24T20:00:05.760Z","repository":{"id":48963316,"uuid":"382504978","full_name":"housemecn/jiguang-client-for-php","owner":"housemecn","description":"极光、推送、认证、短信、魔链 RESTFul API PHP SDK,包括极光推送（JPush）、极光魔链（JMLink）、极光短信（JSMS）、极光认证（JVerification）等相关开源项目。","archived":false,"fork":false,"pushed_at":"2022-06-20T06:14:26.000Z","size":149,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-16T19:58:05.445Z","etag":null,"topics":["jiguang","jmlink","jpush","jsms","jverification","push"],"latest_commit_sha":null,"homepage":"https://housemecn.github.io/jiguang-client-for-php/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/housemecn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-03T02:13:01.000Z","updated_at":"2022-06-20T05:08:19.000Z","dependencies_parsed_at":"2022-08-21T10:10:15.625Z","dependency_job_id":null,"html_url":"https://github.com/housemecn/jiguang-client-for-php","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/housemecn/jiguang-client-for-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/housemecn%2Fjiguang-client-for-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/housemecn%2Fjiguang-client-for-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/housemecn%2Fjiguang-client-for-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/housemecn%2Fjiguang-client-for-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/housemecn","download_url":"https://codeload.github.com/housemecn/jiguang-client-for-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/housemecn%2Fjiguang-client-for-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28007438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jiguang","jmlink","jpush","jsms","jverification","push"],"created_at":"2025-12-24T20:00:04.891Z","updated_at":"2025-12-24T20:00:05.747Z","avatar_url":"https://github.com/housemecn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JiGuang Push\n\n### 极光 API Server SDK for PHP.\n### 包括极光推送（JPush）、极光魔链（JMLink）、极光短信（JSMS）、极光认证（JVerification）等相关开源项目。\n\n[![Latest Stable Version](http://poser.pugx.org/houseme/easyjiguang/v)](https://packagist.org/packages/houseme/easyjiguang)\n[![Total Downloads](http://poser.pugx.org/houseme/easyjiguang/downloads)](https://packagist.org/packages/houseme/easyjiguang) \n[![Latest Unstable Version](http://poser.pugx.org/houseme/easyjiguang/v/unstable)](https://packagist.org/packages/houseme/easyjiguang) \n[![License](http://poser.pugx.org/houseme/easyjiguang/license)](https://packagist.org/packages/houseme/easyjiguang)\n\n\n\u003e 如需友盟推送 请前往 [友盟推送](https://github.com/hedeqiang/UMeng-Push)\n\n目前支持以下：\n- 推送\n- 认证\n- 短信\n- 魔链\n\n## 配置\n\n在使用本扩展之前，你需要去 [极光](https://www.jiguang.cn/) 注册账号，进入开发者平台，然后创建应用，获取应用的 appKey 和 masterSecret。\n\n## Installing\n\n```shell\n$ composer require houseme/easyjiguang -vvv\n```\n\n## Usage\n\n```php\nrequire __DIR__ .'/vendor/autoload.php';\n\n\n$config = [\n    'appKey'       =\u003e 'XXX',\n    'masterSecret' =\u003e 'XXX',\n\n    'groupKey'    =\u003e 'XXX',\n    'groupSecret' =\u003e 'XXX',\n\n    'devKey'        =\u003e 'XXX',\n    'devSecret'     =\u003e 'XXX',\n\n    /*\n     * 指定 API 调用返回结果的类型：array(default)/collection/object/raw/自定义类名\n     */\n    'response_type' =\u003e 'array',\n\n\n    /**\n     * 日志配置\n     *\n     * level: 日志级别, 可选为：\n     *         debug/info/notice/warning/error/critical/alert/emergency\n     * path：日志文件位置(绝对路径!!!)，要求可写权限\n     */\n    'log'           =\u003e [\n        'default'  =\u003e env('APP_DEBUG', false) ? 'dev' : 'prod', // 默认使用的 channel，生产环境可以改为下面的 prod\n        'channels' =\u003e [\n            // 测试环境\n            'dev'  =\u003e [\n                'driver' =\u003e 'single',\n                'path'   =\u003e '/tmp/push.log',\n                'level'  =\u003e 'debug',\n            ],\n            // 生产环境\n            'prod' =\u003e [\n                'driver' =\u003e 'daily',\n                'path'   =\u003e '/tmp/push.log',\n                'level'  =\u003e 'info',\n            ],\n        ],\n    ],\n];\n$app = \\EasyJiGuang\\Factory::JPush($config);\n\n```\n\n## Push API\n\n\u003e 请求参数详见：http://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/\n\n### 推送消息\n\n```php\n$options = [\n    'platform' =\u003e 'all',\n    'audience' =\u003e ['registration_id' =\u003e ['1']],\n    'notification' =\u003e [\n        'alert' =\u003e 'Hello',\n        'android' =\u003e [],\n        'ios' =\u003e [\n            'extras' =\u003e ['newsid' =\u003e '123']\n        ]\n    ],\n    ...\n];\nreturn $app-\u003epush-\u003emessage($options);\n```\n\n### 推送唯一标识符\n\n```php\n$options = [\n   'count' =\u003e 1,\n   'type'  =\u003e 'push',\n];\nreturn $app-\u003epush-\u003egetCid($options);\n```\n\n### 推送校验\n\n```php\n$options = [\n    ...\n    // 该 API 只用于验证推送调用是否能够成功，\n    // 与推送 API 的区别在于：不向用户发送任何消息。 其他字段说明：同推送 API\n];\nreturn $app-\u003epush-\u003evalidate($options);\n```\n\n### 批量单推 针对的是RegID方式批量单推\n\n```php\n$options = [\n    ...\n];\nreturn $app-\u003epush-\u003ebatchRegidSingle($options);\n```\n\n### 批量单推 针对的是Alias方式批量单推\n\n```php\n$options = [\n    ...\n];\nreturn $app-\u003epush-\u003ebatchAliasSingle($options);\n```\n\n### 推送撤销\n\n```php\nreturn $app-\u003epush-\u003erevoke($msgid);\n```\n\n### 文件推送\n\n```php\n$options = [\n    ...\n    'audience' =\u003e [\n        'file' =\u003e ['file_id' =\u003e 'xxxx']\n    ]\n];\nreturn $app-\u003epush-\u003efile($options);\n```\n\n### Group Push API：应用分组推送\n\n```php\n$options = [\n    ...\n];\nreturn $app-\u003epush-\u003egroupPush($options);\n```\n\n### 应用分组文件推送（VIP专属接口）\n\n```php\n$options = [\n    ...\n];\nreturn $app-\u003epush-\u003egroupPushFile($options);\n```\n\n## File API\n\n\u003e 请求参数详见：http://docs.jiguang.cn/jpush/server/push/rest_api_v3_file/\n\n### 上传文件\n\n```php\n$type = 'registration_id'; //type 文件类型，当前可取值为： alias、registration_id，不能为空。\nreturn $app-\u003efile-\u003efiles($type,['filename' =\u003e 'xxx.txt']);\n```\n\n### 查询文件有效列表\n\n```php\nreturn $app-\u003efile-\u003egetFiles();\n```\n\n### 删除文件\n\n```php\nreturn $app-\u003efile-\u003edeleteFiles($file_id);\n```\n\n### 查询指定文件详情\n\n```php\nreturn $app-\u003efile-\u003egetFilesById($file_id);\n```\n\n## Report API\n\n\u003e 请求参数详见：http://docs.jiguang.cn/jpush/server/push/rest_api_v3_report/\n\n### 送达统计详情（新）\n\n```php\n$query = [\n    'msg_ids' =\u003e '1613113584,1229760629'\n];\nreturn $app-\u003ereport-\u003ereceived($query);\n```\n\n### 送达状态查询\n\n```php\n$options = [\n    'msg_id' =\u003e '',\n    'registration_ids' =\u003e '',\n    'date' =\u003e '' //可选\n];\nreturn $app-\u003ereport-\u003estatus($options);\n```\n\n### 消息统计详情（VIP 专属接口，新）\n\n```php\n$query = [\n    'msg_ids' =\u003e '1613113584,1229760629'\n];\nreturn $app-\u003ereport-\u003edetail($query);\n```\n\n### 用户统计（VIP 专属接口）\n\n```php\n$options = [\n    'time_unit' =\u003e '',\n    'start' =\u003e '',\n    'duration' =\u003e ''\n];\nreturn $app-\u003ereport-\u003eusers($options);\n```\n\n### 分组统计-消息统计（VIP 专属接口）\n\n```php\n$query = [\n    'group_msgids' =\u003e '1613113584,1229760629'\n];\nreturn $app-\u003ereport-\u003egroupUsers($query);\n```\n\n### 分组统计-用户统计（VIP 专属接口）\n\n```php\n$options = [\n    'time_unit' =\u003e '',\n    'start' =\u003e '',\n    'duration' =\u003e ''\n];\nreturn $app-\u003ereport-\u003egroupUsers($options);\n```\n\n## Device API\n\n\u003e 请求参数详见：http://docs.jiguang.cn/jpush/server/push/rest_api_v3_device/\n\n### 查询设备的别名与标签\n\n```php\nreturn $app-\u003edevice-\u003egetDevices($registration_id);\n```\n\n### 设置设备的别名与标签\n\n```php\n$options = [\n    'tags'   =\u003e [\n        'add'    =\u003e ['tag1', 'tag2'],\n        'remove' =\u003e ['tag3', 'tag4']\n    ],\n    'alias'  =\u003e 'alias1',\n    'mobile' =\u003e '13012345678'\n];\nreturn $app-\u003edevice-\u003eupdateDevices($registration_id,$options);\n```\n\n### 查询别名\n\n```php\nreturn $app-\u003edevice-\u003egetAliases($alias_value, $platform = ['platform ' =\u003e 'all']);\n```\n\n### 删除别名\n\n```php\nreturn $app-\u003edevice-\u003edeleteAliases($alias_value, $platform = ['platform ' =\u003e 'all']);\n```\n\n### 解绑设备与别名的绑定关系\n\n```php\n$options = [\n    'registration_ids' =\u003e [\n        'remove' =\u003e ['registration_id1','registration_id2']\n    ]\n];\nreturn $app-\u003edevice-\u003eremoveAliases($alias_value, $options);\n```\n\n### 查询标签列表\n\n```php\nreturn $app-\u003edevice-\u003egetTags();\n```\n\n### 判断设备与标签绑定关系\n\n```php\nreturn $app-\u003edevice-\u003eisDeviceInTag($tag_value,$registration_id);\n```\n\n### 更新标签\n\n```php\n$options = [\n    'registration_ids' =\u003e [\n        'add' =\u003e ['registration_id1','registration_id2'],\n        'remove' =\u003e ['registration_id1','registration_id2']\n    ]\n];\nreturn $app-\u003edevice-\u003eupdateTag($tag_value,$options);\n```\n\n### 删除标签\n\n```php\nreturn $app-\u003edevice-\u003edeleteTag($tag_value,$platform = ['platform ' =\u003e 'all']);\n```\n\n### 获取用户在线状态（VIP 专属接口）\n\n```php\n$options = [\n    'registration_ids' =\u003e ['010b81b3582','0207870f1b8','0207870f9b8']\n];\nreturn $app-\u003edevice-\u003estatus($options);\n```\n\n\n## 极光认证\n\u003e 请求参数 详见： https://docs.jiguang.cn/jverification/server/rest_api/rest_api_summary/\n```php\n$app = \\EasyJiGuang\\Factory::JVerify($config);\n\n$options = [\n    'token' =\u003e 'xxx',\n    'phone' =\u003e 'xxx',\n    'exID'  =\u003e 'xxx',\n];\n// 号码认证 提交手机号码和token，验证是否一致\n$app-\u003everify-\u003everify($options);\n// 一键登录 提交loginToken，验证后返回手机号码\n$app-\u003everify-\u003eloginTokenVerify('xxx','xxx');\n```\n\nMore...\n\n## 在 Laravel 中使用\n\n### 发布配置文件\n\n```php\nphp artisan vendor:publish --tag=jiguang\nor \nphp artisan vendor:publish --provider=\"EasyJiGuang\\Providers\\JiGuangServiceProvider\"\n```\n\n### 使用\n\n#### 服务名访问\n\n```php\npublic function index()\n{\n    return app('push')-\u003epush-\u003emessage($options);\n}\n```\n\n#### Facades 门面使用(可以提示)\n\n```php\nuse EasyJiGuang\\Facades\\EasyJiGuang;\n\npublic function index()\n{\n    return EasyJiGuang::JPush()-\u003epush-\u003emessage($options);\n}\n```\n\n### 其他门面\n\n```php\nEasyJiGuang::JVerify()-\u003everify-\u003everify();\n.\n.\n.\n```\n\n更多用法参考：\n\n- http://docs.jiguang.cn/jpush/server/push/server_overview/\n- https://docs.jiguang.cn/jverification/server/rest_api/rest_api_summary/\n\u003e 能力有限 不可能都能测试到，（权限问题等）。遇到错误麻烦帮忙改进，谢谢。\n\n# 鸣谢\n[EasyWechat](https://github.com/w7corp/easywechat)\n\u003e 文中大量代码来自 EasyWechat ，超哥写的代码简直太优雅、太完美。\n\n## Contributing\n\nYou can contribute in one of three ways:\n\n1. File bug reports using the [issue tracker](https://github.com/housemecn/jiguang-client-for-php/issues).\n2. Answer questions or fix bugs on the [issue tracker](https://github.com/housemecn/jiguang-client-for-php/issues).\n3. Contribute new features or update the wiki.\n\n_The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and\nPSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable._\n\n## 工具\n\u003ca target=\"_blank\" href=\"https://www.jetbrains.com/?from=jiguang-client-for-php\"\u003e\u003cimg src=\"https://upyun.laravelcode.cn/upload/JetBrains/jetbrains-training-partner.png\" width=\"100\"/\u003e\u003c/a\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhousemecn%2Fjiguang-client-for-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhousemecn%2Fjiguang-client-for-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhousemecn%2Fjiguang-client-for-php/lists"}