tuhin18003 / php-push-notification-ios-android
PHP开发的iOS、Android及Windows Phone应用程序的定制推送通知服务器。您可以使用自己的PHP服务器来创建推送通知,而不是使用Firebase。
dev-master
2019-12-14 17:02 UTC
Requires
- php: ^7.3
This package is auto-updated.
Last update: 2024-09-15 03:08:44 UTC
README
PHP开发的iOS、Android及Windows Phone应用程序的定制推送通知服务器
它做什么?
- 您可以从自己的PHP服务器构建自定义推送通知服务。
安装
最新版
{ "require": { "tuhin18003/php-push-notification-ios-android": "dev-master" } }
通过命令行
composer require tuhin18003/php-push-notification-ios-android
IOS推送通知示例
require './vendor/autoload.php';
$Push_Notification = new Push_Notification\Push_Notification( 'development' );
$Ios_Notification = $Push_Notification->Ios();
$res = $Ios_Notification->setConfig( array(
'appBundleId' => 'com.test.com',
'deviceToken' => 'your device token',
'passPhrase' => 'your pass',
'pemFileAbsolutePath' => '/pusher.pem'
) );
$Ios_Notification->setPayload(
array(
'aps' => array(
'alert' => array(
'title' => 'test title',
'body' => 'test body',
),
'badge' => (int)10,
'sound' => 'default',
'mutable-content'=> 1,
'content-available'=>1
)
)
);
try {
$push_server_response = $Ios_Notification->send();
throw new Exception( $push_server_response, 1);
} catch (\Throwable $th) {
//throw $th;
echo $th->getMessage();
}
凭证
- 创建者 - M.Tuhin
- 有关任何类型的Web和应用程序开发,请联系我们并访问我们的网站 - CodeSolz.net