{"id":17359061,"url":"https://github.com/zishang520/gtpush","last_synced_at":"2025-08-02T07:31:21.558Z","repository":{"id":57015804,"uuid":"426167155","full_name":"zishang520/gtpush","owner":"zishang520","description":"个推SDK，官方写的sm玩意，https://docs.getui.com/getui/server/rest_v2/introduction/","archived":false,"fork":false,"pushed_at":"2022-07-28T04:01:23.000Z","size":46,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-08T15:49:32.121Z","etag":null,"topics":["getui","gtpush"],"latest_commit_sha":null,"homepage":"","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/zishang520.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-09T09:30:10.000Z","updated_at":"2022-02-12T09:14:39.000Z","dependencies_parsed_at":"2022-08-22T09:31:46.088Z","dependency_job_id":null,"html_url":"https://github.com/zishang520/gtpush","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/zishang520/gtpush","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zishang520%2Fgtpush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zishang520%2Fgtpush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zishang520%2Fgtpush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zishang520%2Fgtpush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zishang520","download_url":"https://codeload.github.com/zishang520/gtpush/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zishang520%2Fgtpush/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266793408,"owners_count":23984911,"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-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["getui","gtpush"],"created_at":"2024-10-15T19:07:56.833Z","updated_at":"2025-08-02T07:31:21.278Z","avatar_url":"https://github.com/zishang520.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 个推SDK RestAPI V2 版本\n\n### 安装包\n```bash\ncomposer require luoyy/gtpush\n```\n###### 在 app.php 中注册服务器提供者(Laravel5.5+支持自动发现)\n```php\nluoyy\\GtPush\\Providers\\PushServiceProvider\n```\n###### ENV\n```env\n#GtPush配置\n# APPID\nGT_PUSH_APPID=\n# APPKEY\nGT_PUSH_APPKEY=\n# MASTER_SECRET\nGT_PUSH_MASTER_SECRET=v2\n# 缓存token的key\nGT_PUSH_TOKEN_CACHE_NAME=\"GT-PUSH-TOKEN\"\n# 给非laravel用的\nGT_PUSH_CACHE_CLASS=\"\\Illuminate\\Support\\Facades\\Cache\"\n```\n\n### Quick Sample Usage\n```php\n/**\n * GtPush DEMO\n */\nuse luoyy\\GtPush\\Facades\\Push;\n\nvar_dump(Push::auth());\nvar_dump(Push::errCode());\nvar_dump(Push::errMsg());\n```\n\n```php\n/**\n * GtPush example\n */\nuse Carbon\\Carbon;\nuse luoyy\\GtPush\\Facades\\Push as GtPush;\nuse luoyy\\GtPush\\Support\\Intent;\nuse luoyy\\GtPush\\Support\\Push\\Android\\Channel as AndroidChannel;\nuse luoyy\\GtPush\\Support\\Push\\Android\\ChannelUps as AndroidChannelUps;\nuse luoyy\\GtPush\\Support\\Push\\Android\\MessageNotification as AndroidMessageNotification;\nuse luoyy\\GtPush\\Support\\Push\\Android\\MessageTransmission as AndroidMessageTransmission;\nuse luoyy\\GtPush\\Support\\Push\\AudienceAll;\nuse luoyy\\GtPush\\Support\\Push\\AudienceCid;\nuse luoyy\\GtPush\\Support\\Push\\Channel;\nuse luoyy\\GtPush\\Support\\Push\\Ios\\Channel as IosChannel;\nuse luoyy\\GtPush\\Support\\Push\\Ios\\ChannelAps as IosChannelAps;\nuse luoyy\\GtPush\\Support\\Push\\Ios\\ChannelApsAlert;\nuse luoyy\\GtPush\\Support\\Push\\Message;\nuse luoyy\\GtPush\\Support\\Push\\MessageNotification;\nuse luoyy\\GtPush\\Support\\Push\\Settings;\nuse luoyy\\GtPush\\Support\\PushObject;\n\n$push_object = new PushObject(\n    Carbon::now()-\u003eunix(),\n    new AudienceCid('cid'), // new AudienceAll(),\n    new Message(\n        null, // Carbon::now()-\u003egetTimestampMs() . '-' . Carbon::now()-\u003eaddMinutes(15)-\u003egetTimestampMs(),\n        (new MessageNotification('测试在线标题', '测试在线内容', MessageNotification::PAYLOAD, '{\"xxx\":1}'))-\u003esetBadgeAddNum(1)\n    )\n);\n$push_object-\u003esetSettings(\n    new Settings(\n        null, // 1 * 24 * 3600 * 1000,\n        [\n            'default' =\u003e 1, // 覆盖配置\n            'ios' =\u003e 4,\n            'st' =\u003e 1,\n            'hw' =\u003e 1,\n            'xm' =\u003e 1,\n            'vv' =\u003e 1,\n            'mz' =\u003e 1,\n            'op' =\u003e 1,\n        ]\n    ),\n);\n$push_object-\u003esetPushChannel(\n    new Channel(\n        new AndroidChannel(\n            new AndroidChannelUps(\n                // new AndroidMessageTransmission('测试透传'),\n                new AndroidMessageNotification('测试Android离线推送标题6#', '测试Android离线推送标题内容1', AndroidMessageNotification::INTENT, new Intent('uni.UNI48A0036', 'io.dcloud.PandoraEntry', '测试Inten#t标题#', '测试I#ntent内容#', json_encode(['default' =\u003e 1, 'ios#' =\u003e 4, 'st' =\u003e 1, 'hw' =\u003e 1, 'xm' =\u003e 1, 'vv' =\u003e 1, 'mz' =\u003e 1, 'op' =\u003e 1]), 'ess', null, 'push')),\n                [\n                    'ALL' =\u003e [\n                        'channel' =\u003e 'Default',\n                    ],\n                    'HW' =\u003e [\n                        '/message/android/notification/badge/add_num' =\u003e 1,\n                        // '/message/android/notification/badge/set_num' =\u003e 0,\n                        '/message/android/notification/badge/class' =\u003e 'io.dcloud.PandoraEntry',\n                        '/message/android/notification/image' =\u003e 'https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/baike@2x-1fe3db7fa6.png',\n                        // '/message/android/notification/style' =\u003e 1,\n                        // '/message/android/notification/big_title' =\u003e '测试Android离线推送标题5',\n                        // '/message/android/notification/big_body' =\u003e '测试Android离线推送标题5测试Android离线推送标题1测试Android离线推送标题1测试Android离线推送标题1测试Android离线推送标题1测试Android离线推送标题1',\n                        '/message/android/notification/importance' =\u003e 'NORMAL', // LOW\n                        // '/message/android/notification/default_sound' =\u003e false,\n                        // '/message/android/notification/channel_id' =\u003e 'RingRing4',\n                        // '/message/android/notification/sound' =\u003e '/raw/ring002',\n                    ],\n                    'OP' =\u003e [\n                        'channel' =\u003e 'Default', // 请先去产商设置 新建channel\n                        'small_picture_id' =\u003e 'xxxxxxxxxxxxxxx',\n                        'style' =\u003e 3, // 通知长文本 value: 2 长文本和大图二选一。 *或复用通知的content接口，长文本样式（style为2）限制字数128个以内。 通知大图 value: 3 长文本和大图二选一。\n                        'big_picture_id' =\u003e 'big_body',\n                    ],\n                    'VV' =\u003e [\n                        'classification' =\u003e 0,\n                    ],\n                    'XM' =\u003e [\n                        'channel' =\u003e 'push', // 请先去产商设置 新建channel\n                        'notification_large_icon_uri' =\u003e 'http://url.large.icon/xxx.png',\n                        'notification_style_type' =\u003e 1,\n                        'notification_bigTxt' =\u003e 'text less than 128 characters',\n                        'notification_bigPic_uri' =\u003e 'http://url.big.pic/xxx.png',\n                        // 'sound_uri' =\u003e 'android.resource://com.pp.infonew/ring001',\n                    ],\n                ]\n            )\n        ),\n        new IosChannel('notify', new IosChannelAps(\n            new ChannelApsAlert('测试IOS离线推送标题1', '测试IOS离线推送标题内容1')\n        ), '+1')\n    )\n);\ndump(GtPush::push_single_cid($push_object));\ndump(GtPush::errCode());\ndump(GtPush::errMsg());\n```\n\n### 更新日志\n* `2021.11.09`：没啥说的，自己看代码[`PushManager.php`](https://github.com/zishang520/gtpush/blob/main/src/PushManager.php)吧，懒得写文档了\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzishang520%2Fgtpush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzishang520%2Fgtpush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzishang520%2Fgtpush/lists"}