承接 brdevelopers/laravel-apn-notification-channel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

brdevelopers/laravel-apn-notification-channel

Composer 安装命令:

composer require brdevelopers/laravel-apn-notification-channel

包简介

Apple Push Notification Service (APNs) notifications channel for Laravel 6 using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)

README 文档

README

Latest Version on Packagist Software License Build Status StyleCI Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications with Laravel 6 to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key).

Contents

Features

  • Uses new Apple APNs HTTP/2 connection
  • Supports JWT-based authentication
  • Supports Certificate-based authentication
  • Supports new iOS 10 features such as Collapse IDs, Subtitles and Mutable Notifications
  • Uses concurrent requests to APNs
  • Tested and working in APNs production environment

Requirements

  • PHP >= 7.2
  • lib-curl >= 7.46.0 (with http/2 support enabled)
  • lib-openssl >= 1.0.2e

Installation

Install this package with Composer:

composer require brdevelopers/laravel-apn-notification-channel

If you're installing the package in Laravel 5.4 or lower, you must import the service provider:

// config/app.php
'providers' => [
    // ...
    BRDevelopers\ApnNotificationChannel\ApnServiceProvider::class,
],

Setting up the APN service

Add the credentials to your config/broadcasting.php:

If you are using JWT-based authentication:

// config/broadcasting.php
'connections' => [
    ...
    'apn' => [
        'driver' => 'jwt',
        'is_production' => env('APP_ENV') === 'production',
        'key_id' => env('APN_KEY_ID'), // The Key ID of the p8 file (available at https://developer.apple.com/account/ios/authkey/)
        'team_id' => env('APN_TEAM_ID'), // The Team ID of your Apple Developer Account (available at https://developer.apple.com/account/#/membership/)
        'app_bundle_id' => env('APN_APP_BUNDLE_ID'), // The Bundle ID of your application. For example, "com.company.application"
        'private_key_path' => env('APN_PRIVATE_KEY', storage_path('apns-private-key.p8')),
        'private_key_secret' => env('APN_PRIVATE_KEY_SECRET'),
    ],
    ...
],

If you are using Certificate-based authentication:

// config/broadcasting.php
'connections' => [
    ...
    'apn' => [
        'driver' => 'certificate',
        'is_production' => env('APP_ENV') === 'production',
        'certificate_path' => env('APN_CERTIFICATE_PATH', storage_path('apns-certificate.pem')),
        'certificate_secret' => env('APN_CERTIFICATE_SECRET'),
    ],
    ...
],

Usage

Now you can use the channel in your via() method inside the notification:

use Illuminate\Notifications\Notification;
use BRDevelopers\ApnNotificationChannel\ApnMessage;

class AccountApproved extends Notification
{
    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['apn'];
    }

    /**
     * Get the APN representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return ApnMessage
     */
    public function toApn($notifiable)
    {
        return ApnMessage::create()
            ->badge(1)
            ->title('Account approved')
            ->body("Your {$notifiable->service} account was approved!");
    }
}

In your notifiable model, make sure to include a routeNotificationForApn() method, which return one or an array of device tokens.

/**
 * Route notifications for the APN channel.
 *
 * @return string|array
 */
public function routeNotificationForApn()
{
    return $this->apn_token;
}

Available Message methods

  • title($str)
  • subtitle($str)
  • body($str)
  • badge($int)
  • sound($str)
  • category($str)
  • custom($key, $value)
  • setCustom($array)
  • titleLocKey($str)
  • titleLocArgs($array)
  • actionLocKey($str)
  • setLocKey($str)
  • setLocArgs($array)
  • launchImage($str)
  • contentAvailability($bool)
  • mutableContent($bool)
  • threadId($str)

TODO

  • Fix Travis CI
  • Fix Scrutinizer CI Code Coverage
  • Add tests

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email semyon.chetvertnyh@gmail.com instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

brdevelopers/laravel-apn-notification-channel 适用场景与选型建议

brdevelopers/laravel-apn-notification-channel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 238 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 05 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「apns」 「push notifications」 「p8」 「php apns」 「laravel apns」 「laravel p8」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 brdevelopers/laravel-apn-notification-channel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 brdevelopers/laravel-apn-notification-channel 我们能提供哪些服务?
定制开发 / 二次开发

基于 brdevelopers/laravel-apn-notification-channel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-18