Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hms-core/hms-push-serverdemo-php
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.
https://github.com/hms-core/hms-push-serverdemo-php
hms huawei php push push-notifications sendmessage sever
Last synced: about 2 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/hms-core/hms-push-serverdemo-php
- Owner: HMS-Core
- License: apache-2.0
- Created: 2020-05-26T01:32:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-28T07:59:18.000Z (over 1 year ago)
- Last Synced: 2024-04-16T12:54:17.415Z (9 months ago)
- Topics: hms, huawei, php, push, push-notifications, sendmessage, sever
- Language: PHP
- Homepage: https://developer.huawei.com/consumer/cn/doc/development/HMS-Guides/push-introduction
- Size: 101 KB
- Stars: 24
- Watchers: 15
- Forks: 21
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HMS Pushkit PHP Severdemo
English | [中文](README_ZH.md)## Table of Contents
* [Introduction](#introduction)
* [Installation](#installation)
* [Configuration](#configuration)
* [Supported Environments](#supported-environments)
* [Sample Code](#sample-code)
* [Technical Support](#technical-support)
* [License](#license)## Introduction
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.| Package | Description
| :--- | :---
| [examples](src/example) | Sample code files. Each PHP file can run independently.
| [push_admin](src/push_admin) | Package where APIs of the HUAWEI Push Kit server are
encapsulated.## Installation
Before using PHP sample code, check whether the PHP environment has been installed.
## Supported Environments
The PHP sample code is debugged based on the XAMPP (MySQL + PHP + PERL) 5.6.26 development suite.
## Configuration
The following table describes parameters of the ____construct__ method.
| Parameter | Description
| :--- | :---
| __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](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/oauth2-0000001212610981).
| __hw_token_server__ | URL for accessing HUAWEI Push Kit, please refer to [Sending Messages](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-server-dev-0000001050040110?ha_source=hms1).## Sample Code
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.| Method | Description
| :--- | :---
| __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.#### 1.Send an Android data message.
Code location: [examples/test_sample_push_passthrouth_msg.php](src/example/test_sample_push_passthrouth_msg.php)#### 2.Send an Android notification message.
Code location: [examples/test_sample_push_notification_msg.php](src/example/test_sample_push_notification_msg.php)#### 3.Send a message by topic.
Code location: [examples/test_sample_push_topic_msg.php](src/example/test_sample_push_topic_msg.php)#### 4.Send a message by conditions.
Code location: [examples/test_sample_push_condition_msg.php](src/example/test_sample_push_condition_msg.php)#### 5.Send a message to a Huawei quick app.
Code location: [examples/test_sample_push_instantce_app_msg.php](src/example/test_sample_push_instantce_app_msg.php)#### 6.Send a message through the WebPush agent.
Code location: [examples/test_sample_push_webpush_msg.php](src/example/test_sample_push_webpush_msg.php)#### 7.Send a message through the APNs agent.
Code location: [examples/test_sample_apns_msg.php](src/example/test_sample_apns_msg.php)#### 8.Send a test message.
Code location: [examples/test_sample_test_push_msg.php](src/example/test_sample_test_push_msg.php)## Technical Support
If you want to evaluate more about HMS Core,
[r/HMSCore on Reddit](https://www.reddit.com/r/HuaweiDevelopers/) 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:
- [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Votes) is the best place for any programming questions. Be sure to tag your question with
`huawei-mobile-services`.
- [Huawei Developer Forum](https://forums.developer.huawei.com/forumPortal/en/home?fid=0101187876626530001) HMS Core Module is great for general questions, or seeking recommendations and opinions.If you run into a bug in our samples, please submit an [issue](https://github.com/HMS-Core/hms-push-serverdemo-php/issues) to the Repository. Even better you can submit a [Pull Request](https://github.com/HMS-Core/hms-push-serverdemo-php/pulls) with a fix.
## License
Pushkit PHP sample is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).