English | 中文
PHP sample code encapsulates APIs of the HUAWEI Push Kit server.It provides many sample
PHP programs about quick access to HUAWEI Push Kit for your reference or usage.
The following table describes packages of PHP sample code.
|examples||Sample code files. Each PHP file can run independently.|
|push_admin||Package where APIs of the HUAWEI Push Kit server are
Before using PHP sample code, check whether the PHP environment has been installed.
The PHP sample code is debugged based on the XAMPP (MySQL + PHP + PERL) 5.6.26 development suite.
The following table describes parameters of the __construct method.
|appid||App ID, which is obtained from app information.|
|appsecret||Secret access key of an app, which is obtained from app information.|
|access_token||URL for the Huawei OAuth 2.0 service to obtain a token,
please refer to Generating an App-Level Access Token.
|hw_token_server||URL for accessing HUAWEI Push Kit, please refer to Sending Messages.|
PHP sample code uses the Application structure in the push_admin package as the entry.
Core methods in the Application structure are used to call APIs of the HUAWEI Push Kit server.
The following table lists methods in Application.
|push_send_msg||Sends a message to a device.|
|common_send_msg||Subscribes to a topic, unsubscribes from a topic,
and queries the list of topics subscribed by a device.
|__construc||Constructor, which obtains key data for sending a message.|
Code location: examples/test_sample_push_passthrouth_msg.php
Code location: examples/test_sample_push_notification_msg.php
Code location: examples/test_sample_push_topic_msg.php
Code location: examples/test_sample_push_condition_msg.php
Code location: examples/test_sample_push_instantce_app_msg.php
Code location: examples/test_sample_push_webpush_msg.php
Code location: examples/test_sample_apns_msg.php
Code location: examples/test_sample_test_push_msg.php
If you want to evaluate more about HMS Core, r/HMSCore on Reddit is for you to keep up with latest news about HMS Core, and to exchange insights with other developers.
If you have questions about how to use HMS samples, try the following options:
If you run into a bug in our samples, please submit an issue to the Repository. Even better you can submit a Pull Request with a fix.
Pushkit PHP sample is licensed under the Apache License, version 2.0.
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容，可点击提交进行申诉，我们将尽快为您处理。
：Code submit frequency
：React/respond to issue & PR etc.
：Well-balanced team members and collaboration
：Recent popularity of project
：Star counts, download counts etc.