{"id":20732407,"url":"https://github.com/jpush/jpush-api-php-client","last_synced_at":"2025-05-15T08:08:45.187Z","repository":{"id":11111344,"uuid":"13467555","full_name":"jpush/jpush-api-php-client","owner":"jpush","description":"JPush's officially supported PHP client library for accessing JPush APIs.  极光推送官方支持的 PHP 版本服务器端 SDK。","archived":false,"fork":false,"pushed_at":"2022-02-24T08:04:11.000Z","size":736,"stargazers_count":523,"open_issues_count":8,"forks_count":210,"subscribers_count":44,"default_branch":"master","last_synced_at":"2024-04-04T08:02:31.309Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.jiguang.cn","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/jpush.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":"2013-10-10T09:43:04.000Z","updated_at":"2023-12-25T13:48:14.000Z","dependencies_parsed_at":"2022-07-27T16:19:00.717Z","dependency_job_id":null,"html_url":"https://github.com/jpush/jpush-api-php-client","commit_stats":null,"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjpush-api-php-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjpush-api-php-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjpush-api-php-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjpush-api-php-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpush","download_url":"https://codeload.github.com/jpush/jpush-api-php-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248871171,"owners_count":21175166,"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","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":[],"created_at":"2024-11-17T05:19:14.411Z","updated_at":"2025-04-14T11:28:33.842Z","avatar_url":"https://github.com/jpush.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JPush API PHP Client\n\n这是 JPush REST API 的 PHP 版本封装开发包，是由极光推送官方提供的，一般支持最新的 API 功能。\n\n对应的 REST API 文档: https://docs.jiguang.cn/jpush/server/push/server_overview/\n\n\u003e 支持的 PHP 版本: 5.3.3 ～ 5.6.x, 7.x\n\n\u003e 若需要兼容 PHP 5.3.3 以下版本，可以使用 [v3 分支的代码](https://github.com/jpush/jpush-api-php-client/tree/v3)。\n因为运行 Composer 需要 PHP 5.3.2+ 以上版本，所以其不提供 Composer 支持，\n也可以[点击链接](https://github.com/jpush/jpush-api-php-client/releases)下载 v3.4.x 版本源码。\n\n## Installation\n\n#### 使用 Composer 安装\n\n- 执行 `$ php composer.phar install` 或 `$ composer install` 进行安装。\n\n#### 直接下载源码安装\n\n\u003e 直接下载源代码也是一种安装 SDK 的方法，不过因为有版本更新的维护问题，所以这种安装方式**十分不推荐**，但由于种种原因导致无法使用 Composer，所以我们也提供了这种情况下的备选方案。\n\n- 下载源代码包，解压到项目中\n- 在项目中引入 autoload：\n\n```php\nrequire 'path_to_sdk/autoload.php';\n```\n\n## Usage\n\n- [Init API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#init-api)\n- [Push API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#push-api)\n- [Report API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#report-api)\n- [Device API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#device-api)\n- [Schedule API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#schedule-api)\n- [Exception Handle](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#schedule-api)\n- [HTTP/2 Support](https://github.com/jpush/jpush-api-php-client/blob/master/doc/http2.md)\n- [Group Push](https://github.com/jpush/jpush-api-php-client/blob/master/doc/grouppush.md)\n\n#### 初始化\n\n```php\nuse JPush\\Client as JPush;\n...\n...\n\n    $client = new JPush($app_key, $master_secret);\n\n...\n```\n\nOR\n\n```php\n$client = new \\JPush\\Client($app_key, $master_secret);\n```\n\n#### 简单推送\n\n```php\n$client-\u003epush()\n    -\u003esetPlatform('all')\n    -\u003eaddAllAudience()\n    -\u003esetNotificationAlert('Hello, JPush')\n    -\u003esend();\n```\n\n#### 异常处理\n\n```php\n$pusher = $client-\u003epush();\n$pusher-\u003esetPlatform('all');\n$pusher-\u003eaddAllAudience();\n$pusher-\u003esetNotificationAlert('Hello, JPush');\ntry {\n    $pusher-\u003esend();\n} catch (\\JPush\\Exceptions\\JPushException $e) {\n    // try something else here\n    print $e;\n}\n```\n\n## Examples\n\n**注意: 这只是使用样例, 不应该直接用于实际环境中!!**\n\n在下载的中的 [examples](https://github.com/jpush/jpush-api-php-client/tree/master/examples) 文件夹有简单示例代码, 开发者可以参考其中的样例快速了解该库的使用方法。\n\n**简单使用方法**\n\n先填写对应的appKey和masterSecret，可以额外设定Registration_id。\n\n若要运行 push_example.php 中的示例代码：\n\n``` bash\n# 假定当前目录为 JPush 源码所在的根目录\n$ php examples/push_example.php\n```\n\u003e 同时也可编辑相关的示例文件，更改参数查看执行效果\n\n## Testing\n\n```bash\n# 编辑 tests/bootstrap.php 文件，填入必须的变量值\n# OR 设置相应的环境变量\n\n# 运行全部测试用例\n$ composer tests\n\n# 运行某一具体测试用例\n$ composer tests/JPush/xxTest.php\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/jpush/jpush-api-php-client.\n\n## License\n\nThe library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpush%2Fjpush-api-php-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpush%2Fjpush-api-php-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpush%2Fjpush-api-php-client/lists"}