定制 lakshanjs/simple-apns-notifications 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lakshanjs/simple-apns-notifications

最新稳定版本:v1.0

Composer 安装命令:

composer require lakshanjs/simple-apns-notifications

包简介

A simple yet powerful PHP class for sending APNs notifications.

README 文档

README

A simple yet powerful PHP class for sending APNs notifications.

Installation

You can install this package via Composer:

composer require lakshanjs/simple-apns-notifications

Usage

require 'vendor/autoload.php';

use SimpleAPNsNotifications\APNsNotification;

$keyId = 'YOUR_KEY_ID'; // Your Key ID
$teamId = 'YOUR_TEAM_ID'; // Your Team ID
$bundleId = 'com.example.yourapp'; // Your Bundle ID
$privateKeyPath = 'path/to/AuthKey_YOUR_KEY_ID.p8'; // Path to your .p8 file
$deviceToken = 'YOUR_DEVICE_TOKEN'; // Device Token

$notification = new APNsNotification($keyId, $teamId, $bundleId, $privateKeyPath);
$notification->setDeviceToken($deviceToken);
$notification->setAlert('Incoming Call', 'You have an incoming call');
$notification->setCustomValue('customKey', 'customValue');
$notification->setPushType('voip'); // Set the push type to 'voip' for VoIP notifications
$notification->setProduction(false); // Set to true for production environment
$notification->setPriority(10); // Set the priority (10 for high, 5 for low)
$notification->setExpiration(time() + 3600); // Set the expiration time to 1 hour from now
$notification->setCollapseId('collapse-id'); // Set the collapse ID

list($httpcode, $response) = $notification->send();

if ($httpcode == 200) {
    echo "Notification sent successfully!\n";
} else {
    echo "Error sending notification: HTTP $httpcode\n";
    echo "Response: $response\n";
}

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 49
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-27