{"id":28456943,"url":"https://github.com/abler98/php-huawei-pushkit","last_synced_at":"2025-06-30T00:32:18.033Z","repository":{"id":62526708,"uuid":"312682183","full_name":"abler98/php-huawei-pushkit","owner":"abler98","description":"HUAWEI Push Kit SDK for PHP","archived":false,"fork":false,"pushed_at":"2020-11-14T12:15:58.000Z","size":35,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-24T09:15:10.539Z","etag":null,"topics":["hms","hms-pushkit","huawei","php","push"],"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/abler98.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":"2020-11-13T20:58:25.000Z","updated_at":"2024-07-16T03:44:25.000Z","dependencies_parsed_at":"2022-11-02T15:45:43.930Z","dependency_job_id":null,"html_url":"https://github.com/abler98/php-huawei-pushkit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/abler98/php-huawei-pushkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abler98%2Fphp-huawei-pushkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abler98%2Fphp-huawei-pushkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abler98%2Fphp-huawei-pushkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abler98%2Fphp-huawei-pushkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abler98","download_url":"https://codeload.github.com/abler98/php-huawei-pushkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abler98%2Fphp-huawei-pushkit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262689561,"owners_count":23349133,"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":["hms","hms-pushkit","huawei","php","push"],"created_at":"2025-06-06T23:09:42.438Z","updated_at":"2025-06-30T00:32:18.019Z","avatar_url":"https://github.com/abler98.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HUAWEI Push Kit SDK for PHP\n\n[![Latest Stable Version](https://poser.pugx.org/megakit/php-huawei-pushkit/v)](//packagist.org/packages/megakit/php-huawei-pushkit)\n[![Total Downloads](https://poser.pugx.org/megakit/php-huawei-pushkit/downloads)](//packagist.org/packages/megakit/php-huawei-pushkit)\n[![Latest Unstable Version](https://poser.pugx.org/megakit/php-huawei-pushkit/v/unstable)](//packagist.org/packages/megakit/php-huawei-pushkit)\n[![License](https://poser.pugx.org/megakit/php-huawei-pushkit/license)](//packagist.org/packages/megakit/php-huawei-pushkit)\n\nSimple SDK for HUAWEI Push Kit server.\n\n## Installation\n\nUse [Composer] to install the package:\n\n```shell script\n$ composer require megakit/php-huawei-pushkit\n```\n\n## Quickstart example\n\n```php\n\u003c?php\n\nuse MegaKit\\Huawei\\PushKit\\Data\\Destination\\TokenDestination;\nuse MegaKit\\Huawei\\PushKit\\Data\\Message\\Android\\AndroidClickAction;\nuse MegaKit\\Huawei\\PushKit\\DataBuilder\\Message\\Android\\AndroidClickActionBuilder;\nuse MegaKit\\Huawei\\PushKit\\DataBuilder\\Message\\Android\\AndroidConfigBuilder;\nuse MegaKit\\Huawei\\PushKit\\DataBuilder\\Message\\Android\\AndroidNotificationBuilder;\nuse MegaKit\\Huawei\\PushKit\\DataBuilder\\Message\\MessageBuilder;\nuse MegaKit\\Huawei\\PushKit\\DataBuilder\\Message\\NotificationBuilder;\nuse MegaKit\\Huawei\\PushKit\\Exceptions\\HuaweiException;\nuse MegaKit\\Huawei\\PushKit\\Factory\\SenderFactory;\nuse MegaKit\\Huawei\\PushKit\\HttpConfigBuilder;\nuse MegaKit\\Huawei\\PushKit\\HuaweiConfigBuilder;\n\n$config = [\n    'app_id' =\u003e '\u003cAPP_ID\u003e',\n    'oauth_client_id' =\u003e '\u003cOAUTH_CLIENT_ID\u003e',\n    'oauth_client_secret' =\u003e '\u003cOAUTH_CLIENT_SECRET\u003e',\n];\n\n$tokens = [\n    '\u003cPUSH_TOKEN_OF_TARGET_USER\u003e',\n];\n\n$huaweiConfig = HuaweiConfigBuilder::withDefaults()\n    -\u003esetAppId($config['app_id'])\n    -\u003esetOAuthCredentials($config['oauth_client_id'], $config['oauth_client_secret'])\n    -\u003ebuild();\n\n$httpConfig = HttpConfigBuilder::withDefaults()-\u003ebuild();\n\n$senderFactory = new SenderFactory();\n$sender = $senderFactory-\u003ecreateSenderWithConfig($huaweiConfig, $httpConfig);\n\n$notification = NotificationBuilder::make()\n    -\u003esetTitle('Hello')\n    -\u003esetBody('World')\n    -\u003ebuild();\n\n$androidNotification = AndroidNotificationBuilder::make()\n    -\u003esetClickAction(\n        AndroidClickActionBuilder::make()\n            -\u003esetType(AndroidClickAction::TYPE_START_APP)\n            -\u003ebuild()\n    )\n    -\u003ebuild();\n\n$androidConfig = AndroidConfigBuilder::make()\n    -\u003esetNotification($androidNotification)\n    -\u003ebuild();\n\n$message = MessageBuilder::make()\n    -\u003esetNotification($notification)\n    -\u003esetAndroid($androidConfig)\n    -\u003esetData(['hello' =\u003e 'world'])\n    -\u003ebuild();\n\n$destination = new TokenDestination($tokens);\n\ntry {\n    $sender-\u003esendMessage($message, $destination);\n    echo 'Message sent successfully' . PHP_EOL;\n} catch (HuaweiException $e) {\n    echo 'Error sending message: ' . $e-\u003egetMessage() . ' (' . $e-\u003egetCode() . ')' . PHP_EOL;\n}\n```\n\nLicense\n-------\n\nAll contents of this package are licensed under the [MIT license].\n\n[Composer]: https://getcomposer.org\n[MIT license]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabler98%2Fphp-huawei-pushkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabler98%2Fphp-huawei-pushkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabler98%2Fphp-huawei-pushkit/lists"}